com.twistedmatrix.spread.pb
Class RemoteReference

java.lang.Object
  |
  +--com.twistedmatrix.spread.pb.RemoteReference

public class RemoteReference
extends java.lang.Object

A reference to a remote object.


Inner Class Summary
 class RemoteReference.RemoteError
          An error on the remote server.
 
Constructor Summary
protected RemoteReference(ByteString perspective, Broker broker, java.lang.Object luid, boolean doRefCount)
          Create a new RemoteReference.
 
Method Summary
 java.lang.Object callRemote(ByteString methodName)
          Send a command to the remote object, blocking until a response is gotten.
 java.lang.Object callRemote(ByteString methodName, java.lang.Object[] args)
          Send a command to the remote object, blocking until a response is gotten.
 java.lang.Object callRemote(ByteString methodName, java.lang.Object[] args, java.util.Map kwargs)
          Send a command to the remote object, blocking until a response is gotten.
 void callRemoteAsync(ByteString methodName, java.lang.Object[] args, Callback callback)
          Send a command to the remote object, getting a response asynchronously.
 void callRemoteAsync(ByteString methodName, java.lang.Object[] args, java.util.Map kwargs, Callback callback)
          Send a command to the remote object, getting a response asynchronously.
 boolean equals(java.lang.Object other)
          Compare to other object.
protected  void finalize()
          Tell remote server we are releasing the reference.
 Broker getBroker()
          Get the broker via which the reference is connected.
protected  java.lang.Object getLuid()
          Get the luid.
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteReference

protected RemoteReference(ByteString perspective,
                          Broker broker,
                          java.lang.Object luid,
                          boolean doRefCount)
Create a new RemoteReference.
Method Detail

getBroker

public Broker getBroker()
Get the broker via which the reference is connected.

getLuid

protected java.lang.Object getLuid()
Get the luid.

callRemoteAsync

public void callRemoteAsync(ByteString methodName,
                            java.lang.Object[] args,
                            java.util.Map kwargs,
                            Callback callback)
                     throws java.io.IOException
Send a command to the remote object, getting a response asynchronously.
Parameters:
methodName - the method to call.
args - a list of arguments to the method.
kwargs - a dictionary of keyword arguments.
callback - callback for result (if callback is null then no answer will be sent.)

callRemoteAsync

public void callRemoteAsync(ByteString methodName,
                            java.lang.Object[] args,
                            Callback callback)
                     throws java.io.IOException
Send a command to the remote object, getting a response asynchronously.
Parameters:
methodName - the method to call.
args - a list of arguments to the method.
callback - callback for result (if callback is null then no answer will be sent.)

callRemote

public java.lang.Object callRemote(ByteString methodName,
                                   java.lang.Object[] args,
                                   java.util.Map kwargs)
                            throws RemoteReference.RemoteError,
                                   java.io.IOException
Send a command to the remote object, blocking until a response is gotten.
Parameters:
args - a list of arguments to the method.
kwargs - a dictionary of keyword arguments.
Returns:
the result of the method call.
Throws:
RemoteReference.RemoteError - if an error was returned.

callRemote

public java.lang.Object callRemote(ByteString methodName,
                                   java.lang.Object[] args)
                            throws RemoteReference.RemoteError,
                                   java.io.IOException
Send a command to the remote object, blocking until a response is gotten.
Parameters:
args - a list of arguments to the method.
Returns:
the result of the method call.
Throws:
RemoteReference.RemoteError - if an error was returned.

callRemote

public java.lang.Object callRemote(ByteString methodName)
                            throws RemoteReference.RemoteError,
                                   java.io.IOException
Send a command to the remote object, blocking until a response is gotten.
Returns:
the result of the method call.
Throws:
RemoteReference.RemoteError - if an error was returned.

equals

public boolean equals(java.lang.Object other)
Compare to other object.
Overrides:
equals in class java.lang.Object

finalize

protected void finalize()
Tell remote server we are releasing the reference.
Overrides:
finalize in class java.lang.Object