class DCell::RPC::Manager

Tracks calls-in-flight

Public Class Methods

claim(call_id) click to toggle source
# 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) click to toggle source
# 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