com.esotericsoftware.kryonet.rmi
Interface RemoteObject


public interface RemoteObject

Provides access to various settings on a remote object.

Author:
Nathan Sweet
See Also:
ObjectSpace.getRemoteObject(com.esotericsoftware.kryonet.Connection, int, Class...)

Method Summary
 void close()
          Causes this RemoteObject to stop listening to the connection for method invocation response messages.
 byte getLastResponseID()
          Gets the ID of response for the last method invocation.
 void setNonBlocking(boolean nonBlocking, boolean ignoreResponses)
          Sets the blocking behavior when invoking a method that has a return value.
 void setResponseTimeout(int timeoutMillis)
          Sets the milliseconds to wait for a method to return value.
 java.lang.Object waitForLastResponse()
          Waits for the response to the last method invocation to be received or the response timeout to be reached.
 java.lang.Object waitForResponse(byte responseID)
          Waits for the specified method invocation response to be received or the response timeout to be reached.
 

Method Detail

setResponseTimeout

void setResponseTimeout(int timeoutMillis)
Sets the milliseconds to wait for a method to return value. Default is 3000.


setNonBlocking

void setNonBlocking(boolean nonBlocking,
                    boolean ignoreResponses)
Sets the blocking behavior when invoking a method that has a return value.

Parameters:
nonBlocking - If false, the invoking thread will wait for a return value or timeout (default). If true, the invoking thread will not wait for a response. The response can later be retrieved with waitForLastResponse() or waitForResponse(byte). The method will return immediately and the return value should be ignored.
ignoreResponses - If false, then the response for non-blocking method invocations can be retrieved with waitForLastResponse() or waitForResponse(byte). The responses will be stored until retrieved, so each method call should have a matching retrieve. If true, then the response to non-blocking method invocations will never be sent by the remote side of the connection and the response can never be retrieved.

waitForLastResponse

java.lang.Object waitForLastResponse()
Waits for the response to the last method invocation to be received or the response timeout to be reached. Must not be called from the connection's update thread.

See Also:
ObjectSpace.getRemoteObject(com.esotericsoftware.kryonet.Connection, int, Class...)

getLastResponseID

byte getLastResponseID()
Gets the ID of response for the last method invocation.


waitForResponse

java.lang.Object waitForResponse(byte responseID)
Waits for the specified method invocation response to be received or the response timeout to be reached. Must not be called from the connection's update thread.

See Also:
ObjectSpace.getRemoteObject(com.esotericsoftware.kryonet.Connection, int, Class...)

close

void close()
Causes this RemoteObject to stop listening to the connection for method invocation response messages.