Class: ZooKeeper::EventMachine::AsyncOp
- Defined in:
- lib/zkruby/eventmachine.rb
Overview
class Binding
Instance Attribute Summary
Attributes inherited from AsyncOp
Instance Method Summary collapse
-
#initialize(binding, &callback) ⇒ AsyncOp
constructor
A new instance of AsyncOp.
- #resume(error, response) ⇒ Object
Methods inherited from AsyncOp
Constructor Details
#initialize(binding, &callback) ⇒ AsyncOp
Returns a new instance of AsyncOp.
145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/zkruby/eventmachine.rb', line 145 def initialize(binding,&callback) @em_binding = binding # Wrap the callback in its own Strand @op_strand = Strand.new do #immediately pause error, response = Strand.yield Strand.current[ZooKeeper::CURRENT] = [ @em_binding.client ] raise error if error callback.call(response) end end |
Instance Method Details
#resume(error, response) ⇒ Object
158 159 160 161 |
# File 'lib/zkruby/eventmachine.rb', line 158 def resume(error,response) #TODO - raise issue in strand for resume to take arguments op_strand.fiber.resume(error,response) end |