public interface RemoteObject
ObjectSpace.getRemoteObject(com.esotericsoftware.kryonet.Connection, int, Class...)
Modifier and Type | Method and Description |
---|---|
void |
close()
Causes this RemoteObject to stop listening to the connection for method invocation response messages.
|
Connection |
getConnection()
Returns the local connection for this remote object.
|
byte |
getLastResponseID()
Gets the ID of response for the last method invocation.
|
void |
setNonBlocking(boolean nonBlocking)
Sets the blocking behavior when invoking a remote method.
|
void |
setResponseTimeout(int timeoutMillis)
Sets the milliseconds to wait for a method to return value.
|
void |
setTransmitExceptions(boolean transmit)
Sets whether exceptions are sent back when invoking a remote method.
|
void |
setTransmitReturnValue(boolean transmit)
Sets whether return values are sent back when invoking a remote method.
|
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.
|
void setResponseTimeout(int timeoutMillis)
void setNonBlocking(boolean nonBlocking)
nonBlocking
- If false, the invoking thread will wait for the remote method to return or timeout (default). If true,
the invoking thread will not wait for a response. The method will return immediately and the return value should
be ignored. If they are being transmitted, the return value or any thrown exception can later be retrieved with
waitForLastResponse()
or waitForResponse(byte)
. The responses will be stored until retrieved, so
each method call should have a matching retrieve.void setTransmitReturnValue(boolean transmit)
transmit
- If true, then the return value for non-blocking method invocations can be retrieved with
waitForLastResponse()
or waitForResponse(byte)
. If false, then non-primitive return values for
remote method invocations are not sent by the remote side of the connection and the response can never be
retrieved. This can also be used to save bandwidth if you will not check the return value of a blocking remote
invocation. Note that an exception could still be returned by waitForLastResponse()
or
waitForResponse(byte)
if setTransmitExceptions(boolean)
is true.void setTransmitExceptions(boolean transmit)
transmit
- If false, exceptions will be unhandled and rethrown as RuntimeExceptions inside the invoking thread. This is
the legacy behavior. If true, behavior is dependent on whether setNonBlocking(boolean)
. If non-blocking
is true, the exception will be serialized and sent back to the call site of the remotely invoked method, where it
will be re-thrown. If non-blocking is false, an exception will not be thrown in the calling thread but instead can
be retrieved with waitForLastResponse()
or waitForResponse(byte)
, similar to a return value.java.lang.Object waitForLastResponse()
byte getLastResponseID()
java.lang.Object waitForResponse(byte responseID)
void close()
Connection getConnection()