Package com.jme3.network.service.rpc
Class RpcConnection
java.lang.Object
com.jme3.network.service.rpc.RpcConnection
Wraps a message connection to provide RPC call support. This
is used internally by the RpcClientService and RpcHostedService to manage
network messaging.
-
Constructor Summary
ConstructorDescriptionRpcConnection
(MessageConnection connection) Creates a new RpcConnection for the specified network connection. -
Method Summary
Modifier and TypeMethodDescriptioncallAndWait
(byte channel, short objId, short procId, Object... args) Performs a remote procedure call with the specified arguments and waits for the response.void
Performs a remote procedure call with the specified arguments but does not wait for a response.void
close()
Clears any pending synchronous calls causing them to throw an exception with the message "Closing connection".void
Called internally when an RpcCallMessage is received from the remote connection.void
Called internally when an RpcResponseMessage is received from the remote connection.void
registerHandler
(short objId, RpcHandler handler) Register a handler that can be called by the other end of the connection using the specified object ID.void
removeHandler
(short objId, RpcHandler handler) Removes a previously registered handler for the specified object ID.protected void
send
(byte channel, RpcResponseMessage msg)
-
Constructor Details
-
RpcConnection
Creates a new RpcConnection for the specified network connection.
-
-
Method Details
-
close
public void close()Clears any pending synchronous calls causing them to throw an exception with the message "Closing connection". -
callAndWait
Performs a remote procedure call with the specified arguments and waits for the response. Both the outbound message and inbound response will be sent on the specified channel. -
callAsync
Performs a remote procedure call with the specified arguments but does not wait for a response. The outbound message is sent on the specified channel. There is no inbound response message. -
registerHandler
Register a handler that can be called by the other end of the connection using the specified object ID. Only one handler per object ID can be registered at any given time, though the same handler can be registered for multiple object IDs. -
removeHandler
Removes a previously registered handler for the specified object ID. -
send
-
handleMessage
Called internally when an RpcCallMessage is received from the remote connection. -
handleMessage
Called internally when an RpcResponseMessage is received from the remote connection.
-