Package com.jme3.network.service.rpc
Class RpcHostedService
java.lang.Object
com.jme3.network.service.AbstractService<HostedServiceManager>
com.jme3.network.service.AbstractHostedService
com.jme3.network.service.AbstractHostedConnectionService
com.jme3.network.service.rpc.RpcHostedService
- All Implemented Interfaces:
- ConnectionListener,- HostedService,- Service<HostedServiceManager>
RPC service that can be added to a network Server to
  add RPC send/receive capabilities.  For a particular
  HostedConnection, Remote procedure calls can be made to the 
  associated Client and responses retrieved.  Any remote procedure 
  calls that the Client performs for this connection will be 
  received by this service and delegated to the appropriate RpcHandlers.
  Note: it can be dangerous for a server to perform synchronous
  RPC calls to a client but especially so if not done as part
  of the response to some other message.  ie: iterating over all
  or some HostedConnections to perform synchronous RPC calls
  will be slow and potentially block the server's threads in ways
  that can cause deadlocks or odd contention.
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a new RPC host service that can be registered with the Network server and will automatically 'host' RPC services and each new network connection.RpcHostedService(boolean autoHost) Creates a new RPC host service that can be registered with the Network server and will optionally 'host' RPC services and each new network connection depending on the specified 'autoHost' flag.
- 
Method SummaryModifier and TypeMethodDescriptionRetrieves the RpcConnection for the specified HostedConnection if that HostedConnection has had RPC services started using startHostingOnConnection() (or via autohosting).protected voidonInitialize(HostedServiceManager serviceManager) Used internally to set up the message delegator that will handle HostedConnection specific messages and forward them to that connection's RpcConnection.voidSets up RPC hosting services for the hosted connection allowing getRpcConnection() to return a valid RPC connection object.voidRemoves any RPC hosting services associated with the specified connection.voidterminate(HostedServiceManager serviceManager) Used internally to remove the message delegator from the server.Methods inherited from class com.jme3.network.service.AbstractHostedConnectionServiceconnectionAdded, connectionRemoved, getAutoHost, setAutoHostMethods inherited from class com.jme3.network.service.AbstractHostedServicegetServerMethods inherited from class com.jme3.network.service.AbstractServicegetService, getServiceManager, initialize, start, stop, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.jme3.network.service.HostedServiceinitialize, start, stop
- 
Constructor Details- 
RpcHostedServicepublic RpcHostedService()Creates a new RPC host service that can be registered with the Network server and will automatically 'host' RPC services and each new network connection.
- 
RpcHostedServicepublic RpcHostedService(boolean autoHost) Creates a new RPC host service that can be registered with the Network server and will optionally 'host' RPC services and each new network connection depending on the specified 'autoHost' flag.
 
- 
- 
Method Details- 
onInitializeUsed internally to set up the message delegator that will handle HostedConnection specific messages and forward them to that connection's RpcConnection.- Specified by:
- onInitializein class- AbstractService<HostedServiceManager>
 
- 
getRpcConnectionRetrieves the RpcConnection for the specified HostedConnection if that HostedConnection has had RPC services started using startHostingOnConnection() (or via autohosting). Returns null if the connection currently doesn't have RPC hosting services attached.
- 
startHostingOnConnectionSets up RPC hosting services for the hosted connection allowing getRpcConnection() to return a valid RPC connection object. This method is called automatically for all new connections if autohost is set to true.- Specified by:
- startHostingOnConnectionin class- AbstractHostedConnectionService
 
- 
stopHostingOnConnectionRemoves any RPC hosting services associated with the specified connection. Calls to getRpcConnection() will return null for this connection. The connection's RpcConnection is also closed, releasing any waiting synchronous calls with a "Connection closing" error. This method is called automatically for all leaving connections if autohost is set to true.- Specified by:
- stopHostingOnConnectionin class- AbstractHostedConnectionService
 
- 
terminateUsed internally to remove the message delegator from the server.- Specified by:
- terminatein interface- HostedService
- Specified by:
- terminatein interface- Service<HostedServiceManager>
- Overrides:
- terminatein class- AbstractService<HostedServiceManager>
 
 
-