Registry is a remote interface to a simple remote
object registry that provides methods for storing and retrieving
remote object references bound with arbitrary string names. The
bind, unbind, and rebind
methods are used to alter the name bindings in the registry, and
the lookup and list methods are used to
query the current name bindings.
In its typical usage, a Registry enables RMI client
bootstrapping: it provides a simple means for a client to obtain an
initial reference to a remote object. Therefore, a registry's
remote object implementation is typically exported with a
well-known address, such as with a well-known ObjID and TCP port number
(default is 1099).
The LocateRegistry class provides a programmatic API for
constructing a bootstrap reference to a Registry at a
remote address (see the static getRegistry methods)
and for creating and exporting a Registry in the
current VM on a particular local address (see the static
createRegistry methods).
A Registry implementation may choose to restrict
access to some or all of its methods (for example, methods that
mutate the registry's bindings may be restricted to calls
originating from the local host). If a Registry
method chooses to deny access for a given invocation, its
implementation may throw java., which
(because it extends java.) will be
wrapped in a java. when caught by a
remote client.
The names used for bindings in a Registry are pure
strings, not parsed. A service which stores its remote reference
in a Registry may wish to use a package name as a
prefix in the name binding to reduce the likelihood of name
collisions in the registry.
LocateRegistry
| Modifier and Type | Field and Description |
|---|---|
| public static final int | REGISTRY_PORT
Well known port for registry. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public String[] | Returns: an array of the names bound in this registryReturns an array of the names bound in this registry. |
| public Remote | |
| public void | |
| public void |
| REGISTRY_PORT | back to summary |
|---|---|
| public static final int REGISTRY_PORT Well known port for registry. | |
| bind | back to summary |
|---|---|
| public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException Binds a remote reference to the specified
| |
| list | back to summary |
|---|---|
| public String[] list() throws RemoteException, AccessException Returns an array of the names bound in this registry. The array will contain a snapshot of the names bound in this registry at the time of the given invocation of this method.
| |
| lookup | back to summary |
|---|---|
| public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException Returns the remote reference bound to the specified
| |
| rebind | back to summary |
|---|---|
| public void rebind(String name, Remote obj) throws RemoteException, AccessException Replaces the binding for the specified
| |
| unbind | back to summary |
|---|---|
| public void unbind(String name) throws RemoteException, NotBoundException, AccessException Removes the binding for the specified
| |