Class RmiRegistry
java.lang.Object
com.jme3.network.service.rmi.RmiRegistry
Maintains locally shared objects and remote proxies for the RMI service.
- Author:
- Paul Speed
-
Constructor Summary
ConstructorsConstructorDescriptionRmiRegistry(HostedConnection context, RpcConnection rpc, short rmiId, byte defaultChannel) Creates an RMI registry.RmiRegistry(RpcConnection rpc, short rmiId, byte defaultChannel) Creates an RMI registry without a server-side connection context. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddRemoteClass(ClassInfo info) Registers remote class metadata announced by the far end.protected voidaddRemoteObject(byte channel, short objectId, String name, ClassInfo typeInfo) Registers a remote object proxy from metadata received over the wire.<T> TgetLocalObject(Class<T> type) Returns a local object that was previously registered with share() using just type registration.<T> TgetLocalObject(String name, Class<T> type) Returns a local object that was previously registered with share() using name registration.<T> TgetRemoteObject(Class<T> type) Looks up a remote object by type and returns a local proxy to the remote object that was shared on the other end of the network connection.<T> TgetRemoteObject(String name, Class<T> type) Looks up a remote object by name and returns a local proxy to the remote object that was shared on the other end of the network connection.protected ObjectinvokeLocal(short objectId, short procId, Object[] args) Handle the actual remote object method calls.protected ObjectinvokeRemote(byte channel, short objectId, short procId, CallType callType, Object[] args) Invokes a remote procedure through the configured RPC layer.protected voidremoveRemoteObject(short objectId) Removes a previously registered remote object.protected voidHandle remote object registry updates from the other end.<T> voidExposes, through a specific connection channel, the specified object to the other end of the connection as the specified interface type and associates it with the specified name.<T> voidExposes, through a specific connection channel, the specified object to the other end of the connection as the specified interface type.<T> voidExposes the specified object to the other end of the connection as the specified interface type and associates it with the specified name.<T> voidExposes the specified object to the other end of the connection as the specified interface type.
-
Constructor Details
-
RmiRegistry
Creates an RMI registry without a server-side connection context.- Parameters:
rpc- the backing RPC connectionrmiId- the registry RPC object iddefaultChannel- the default network channel for RMI traffic
-
RmiRegistry
Creates an RMI registry.- Parameters:
context- the hosted connection currently associated with local RMI calls, or nullrpc- the backing RPC connectionrmiId- the registry RPC object iddefaultChannel- the default network channel for RMI traffic
-
-
Method Details
-
getLocalObject
Returns a local object that was previously registered with share() using just type registration.- Type Parameters:
T- the requested object type- Parameters:
type- the shared interface type- Returns:
- the shared local object
-
getLocalObject
Returns a local object that was previously registered with share() using name registration.- Type Parameters:
T- the requested object type- Parameters:
name- the exported object nametype- the shared interface type- Returns:
- the shared local object
-
getRemoteObject
Looks up a remote object by type and returns a local proxy to the remote object that was shared on the other end of the network connection. If this is called from a client then it is accessing a shared object registered on the server. If this is called from the server then it is accessing a shared object registered on the client.- Type Parameters:
T- the requested proxy type- Parameters:
type- the shared interface type- Returns:
- the remote object proxy
-
getRemoteObject
Looks up a remote object by name and returns a local proxy to the remote object that was shared on the other end of the network connection. If this is called from a client then it is accessing a shared object registered on the server. If this is called from the server then it is accessing a shared object registered on the client.- Type Parameters:
T- the requested proxy type- Parameters:
name- the exported object nametype- the shared interface type- Returns:
- the remote object proxy
-
addRemoteClass
Registers remote class metadata announced by the far end.- Parameters:
info- the remote class metadata
-
removeRemoteObject
protected void removeRemoteObject(short objectId) Removes a previously registered remote object.- Parameters:
objectId- the remote object id
-
addRemoteObject
Registers a remote object proxy from metadata received over the wire.- Parameters:
channel- the message channel used for method callsobjectId- the remote object idname- the exported object nametypeInfo- the remote object type metadata
-
invokeRemote
protected Object invokeRemote(byte channel, short objectId, short procId, CallType callType, Object[] args) Invokes a remote procedure through the configured RPC layer.- Parameters:
channel- the message channel to useobjectId- the remote object idprocId- the remote procedure idcallType- the invocation modeargs- the invocation arguments- Returns:
- the remote return value for synchronous calls, or
nullotherwise
-
rmiUpdate
Handle remote object registry updates from the other end.- Parameters:
procId- the registry update procedure idargs- the registry update arguments
-
invokeLocal