Class: DCell::RPC::Manager
- Inherits:
-
Object
- Object
- DCell::RPC::Manager
- Defined in:
- lib/dcell/rpc.rb
Overview
Tracks calls-in-flight
Class Method Summary collapse
Class Method Details
.claim(call_id) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/dcell/rpc.rb', line 82 def self.claim(call_id) @mutex.lock begin ref = @calls.delete(call_id) ref.__getobj__ if ref rescue WeakRef::RefError # Nothing to see here, folks ensure @mutex.unlock rescue nil end end |
.register(call) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/dcell/rpc.rb', line 66 def self.register(call) @mutex.lock begin call_id = @ids[call.object_id] unless call_id call_id = Celluloid.uuid @ids[call.object_id] = call_id end @calls[call_id] = WeakRef.new(call) call_id ensure @mutex.unlock rescue nil end end |