Modifier and Type | Field and Description |
---|---|
private ClassFileServer |
classFileServer
A class file server to enable remote dynamic class loading of the
ICompute object.
|
private IVoidLambda<java.lang.String> |
outputCmd
Command used to output strings to one or more destinations.
|
Constructor and Description |
---|
RMIUtils(IVoidLambda<java.lang.String> outputCmd)
Constructor for the class.
|
Modifier and Type | Method and Description |
---|---|
private void |
configRMIProperties(int classServerPort)
Sets the java.rmi.server.hostname and java.rmi.server.codebase
system properties which control the automatic remote dynamic
class loading.
|
private void |
configSecurityManager()
Sets the java.security.policy system property to point at the location
of the security policy file, which is assumed to be at
"provided\rmiUtils\server.policy" (file separators adjusted to
match operating system).
|
java.lang.String |
getLocalAddress()
This method is designed to reliably return the actual local IP address
across multiple platforms, particularly Linux.
|
java.rmi.registry.Registry |
getLocalRegistry()
Returns the Registry on the local machine on port
IRMI_Defs.REGISTRY_PORT, as a server would require.
|
java.rmi.registry.Registry |
getRemoteRegistry(java.lang.String host)
Returns the Registry on the given machine on port
IRMI_Defs.REGISTRY_PORT, as a client would require.
|
private void |
startClassFileServer(int classServerPort)
Start the class file server to support remote dynamic class loading.
|
void |
startRMI(int classServerPort)
Start up the RMI system.
|
private void |
stopClassFileServer()
Stop the class file server and reset the reference to it,
"classFileServer", to null.
|
void |
stopRMI()
Performs all necessary work to shut the RMI system down,
such as shut the class server down.
|
private IVoidLambda<java.lang.String> outputCmd
private ClassFileServer classFileServer
public RMIUtils(IVoidLambda<java.lang.String> outputCmd)
outputCmd
- command used to output status and error informationpublic java.rmi.registry.Registry getLocalRegistry()
getLocalRegistry
in interface IRMIUtils
public java.rmi.registry.Registry getRemoteRegistry(java.lang.String host)
getRemoteRegistry
in interface IRMIUtils
host
- the IP address or host name of the remote machine.public java.lang.String getLocalAddress() throws java.net.SocketException, java.net.UnknownHostException
getLocalAddress
in interface IRMIUtils
java.net.SocketException
- thrown when there is a problem retrieving the network
interfaces.java.net.UnknownHostException
- thrown when the local host address cannot be found.public void startRMI(int classServerPort)
private void configRMIProperties(int classServerPort)
classServerPort
- The port the class server will use.private void configSecurityManager()
private void startClassFileServer(int classServerPort)
classServerPort
- the port the class file server will use.private void stopClassFileServer()