Class LocateRegistry
LocateRegistry is used to obtain a reference to a bootstrap
remote object registry on a particular host (including the local host), or
to create a remote object registry that accepts calls on a specific port.
Note that a getRegistry call does not actually make a
connection to the remote host. It simply creates a local reference to
the remote registry and will succeed even if no registry is running on
the remote host. Therefore, a subsequent method invocation to a remote
registry returned as a result of this method may fail.
- Since:
- 1.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic RegistrycreateRegistry(int port) Creates and exports aRegistryinstance on the local host that accepts requests on the specifiedport.static RegistrycreateRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) Creates and exports aRegistryinstance on the local host that uses custom socket factories for communication with that instance.static RegistryReturns a reference to the remote objectRegistryfor the local host on the default registry port of 1099.static RegistrygetRegistry(int port) Returns a reference to the remote objectRegistryfor the local host on the specifiedport.static RegistrygetRegistry(String host) Returns a reference to the remote objectRegistryon the specifiedhoston the default registry port of 1099.static RegistrygetRegistry(String host, int port) Returns a reference to the remote objectRegistryon the specifiedhostandport.static RegistrygetRegistry(String host, int port, RMIClientSocketFactory csf) Returns a locally created remote reference to the remote objectRegistryon the specifiedhostandport.
-
Method Details
-
getRegistry
Returns a reference to the remote objectRegistryfor the local host on the default registry port of 1099.- Returns:
- reference (a stub) to the remote object registry
- Throws:
RemoteException- if the reference could not be created- Since:
- 1.1
-
getRegistry
Returns a reference to the remote objectRegistryfor the local host on the specifiedport.- Parameters:
port- port on which the registry accepts requests- Returns:
- reference (a stub) to the remote object registry
- Throws:
RemoteException- if the reference could not be created- Since:
- 1.1
-
getRegistry
Returns a reference to the remote objectRegistryon the specifiedhoston the default registry port of 1099. Ifhostisnull, the local host is used.- Parameters:
host- host for the remote registry- Returns:
- reference (a stub) to the remote object registry
- Throws:
RemoteException- if the reference could not be created- Since:
- 1.1
-
getRegistry
Returns a reference to the remote objectRegistryon the specifiedhostandport. Ifhostisnull, the local host is used.- Parameters:
host- host for the remote registryport- port on which the registry accepts requests- Returns:
- reference (a stub) to the remote object registry
- Throws:
RemoteException- if the reference could not be created- Since:
- 1.1
-
getRegistry
public static Registry getRegistry(String host, int port, RMIClientSocketFactory csf) throws RemoteException Returns a locally created remote reference to the remote objectRegistryon the specifiedhostandport. Communication with this remote registry will use the suppliedRMIClientSocketFactorycsfto createSocketconnections to the registry on the remotehostandport.- Parameters:
host- host for the remote registryport- port on which the registry accepts requestscsf- client-sideSocketfactory used to make connections to the registry. Ifcsfis null, then the default client-sideSocketfactory will be used in the registry stub.- Returns:
- reference (a stub) to the remote registry
- Throws:
RemoteException- if the reference could not be created- Since:
- 1.2
-
createRegistry
Creates and exports aRegistryinstance on the local host that accepts requests on the specifiedport.The
Registryinstance is exported as if the staticUnicastRemoteObject.exportObjectmethod is invoked, passing theRegistryinstance and the specifiedportas arguments, except that theRegistryinstance is exported with a well-known object identifier, anObjIDinstance constructed with the valueObjID.REGISTRY_ID.- Parameters:
port- the port on which the registry accepts requests- Returns:
- the registry
- Throws:
RemoteException- if the registry could not be exported- Since:
- 1.1
-
createRegistry
public static Registry createRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException Creates and exports aRegistryinstance on the local host that uses custom socket factories for communication with that instance. The registry that is created listens for incoming requests on the givenportusing aServerSocketcreated from the suppliedRMIServerSocketFactory.The
Registryinstance is exported as if the staticUnicastRemoteObject.exportObjectmethod is invoked, passing theRegistryinstance, the specifiedport, the specifiedRMIClientSocketFactory, and the specifiedRMIServerSocketFactoryas arguments, except that theRegistryinstance is exported with a well-known object identifier, anObjIDinstance constructed with the valueObjID.REGISTRY_ID.- Parameters:
port- port on which the registry accepts requestscsf- client-sideSocketfactory used to make connections to the registryssf- server-sideServerSocketfactory used to accept connections to the registry- Returns:
- the registry
- Throws:
RemoteException- if the registry could not be exported- Since:
- 1.2
-