Class RpcConnection

java.lang.Object
com.jme3.network.service.rpc.RpcConnection

public class RpcConnection extends Object
Wraps a message connection to provide RPC call support. This is used internally by the RpcClientService and RpcHostedService to manage network messaging.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new RpcConnection for the specified network connection.
  • Method Summary

    Modifier and Type
    Method
    Description
    callAndWait(byte channel, short objId, short procId, Object... args)
    Performs a remote procedure call with the specified arguments and waits for the response.
    void
    callAsync(byte channel, short objId, short procId, Object... args)
    Performs a remote procedure call with the specified arguments but does not wait for a response.
    void
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RpcConnection

      public RpcConnection(MessageConnection connection)
      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

      public Object callAndWait(byte channel, short objId, short procId, Object... args)
      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

      public void callAsync(byte channel, short objId, short procId, Object... args)
      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

      public 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. 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

      public void removeHandler(short objId, RpcHandler handler)
      Removes a previously registered handler for the specified object ID.
    • send

      protected void send(byte channel, RpcResponseMessage msg)
    • handleMessage

      public void handleMessage(RpcCallMessage msg)
      Called internally when an RpcCallMessage is received from the remote connection.
    • handleMessage

      public void handleMessage(RpcResponseMessage msg)
      Called internally when an RpcResponseMessage is received from the remote connection.