Class RmiClientService
- All Implemented Interfaces:
ClientService
,Service<ClientServiceManager>
Objects are shared by adding them to the RmiRegistry with one of the share() methods. Shared objects must have a separate interface and implementation. The interface is what the other end of the connection will use to interact with the object and that interface class must be available on both ends of the connection. The implementing class need only be on the sharing end.
Shared objects can be accessed on the other end of the connection by using one of the RmiRegistry's getRemoteObject() methods. These can be used to lookup an object by class if it is a shared singleton or by name if it was registered with a name.
Note: This RMI implementation is not as advanced as Java's regular RMI as it won't marshall shared references, ie: you can't pass a shared objects as an argument to another shared object's method.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
getRemoteObject
(Class<T> type) Looks up a remote object on the server by type and returns a local proxy to the remote object that was shared on the other end of the network connection.<T> T
getRemoteObject
(String name, Class<T> type) Looks up a remote object on the server by name and returns a local proxy to the remote object that was shared on the other end of the network connection.protected void
Called during initialize() for the subclass to perform implementation specific initialization.<T> void
Shares the specified object with the server and associates it with the specified name.<T> void
Shares the specified object with the server and associates it with the specified type.<T> void
Shares the specified object with the server and associates it with the specified name.<T> void
Shares the specified object with the server and associates it with the specified type.void
start()
Default implementation does nothing.Methods inherited from class com.jme3.network.service.AbstractClientService
getClient
Methods inherited from class com.jme3.network.service.AbstractService
getService, getServiceManager, initialize, stop, terminate, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.jme3.network.service.ClientService
initialize, stop, terminate
-
Constructor Details
-
RmiClientService
public RmiClientService() -
RmiClientService
public RmiClientService(short rmiObjectId, byte defaultChannel)
-
-
Method Details
-
getRemoteObject
Looks up a remote object on the server by type and returns a local proxy to the remote object that was shared on the other end of the network connection. -
getRemoteObject
Looks up a remote object on the server by name and returns a local proxy to the remote object that was shared on the other end of the network connection. -
onInitialize
Description copied from class:AbstractService
Called during initialize() for the subclass to perform implementation specific initialization.- Specified by:
onInitialize
in classAbstractService<ClientServiceManager>
-
start
public void start()Description copied from class:AbstractService
Default implementation does nothing. Implementations can override this to perform custom startup behavior.- Specified by:
start
in interfaceClientService
- Specified by:
start
in interfaceService<ClientServiceManager>
- Overrides:
start
in classAbstractService<ClientServiceManager>