The Registry is an interface to the RMI object
registry that runs on every node in a distributed RMI system. While
the Naming interface can be used to look up
objects stored in any registry on the network, a
Registry operates on a single registry on a
single host. URL object names are passed into methods on the
Naming service, which finds the right
Registry stub using the
LocateRegistry interface, and then calls the
lookup() method on the remote (or local)
Registry to get a stub for the remote object. A
similar sequence of calls takes place with the local
Registry when bind(),
rebind(), or unbind() are
called on the Naming interface.
The Registry stores objects under unique names.
An object is assigned to a name in the Registry
using its
bind() method. The object assigned to a
particular name can be changed using the
rebind() method. Objects are removed from
the Registry using the
unbind() method. The
lookup() method is used to find objects by
name in the Registry, and the
list() method is used to get a list of the
names of all of the objects currently in the
Registry.
public interface Registry extends Remote {
// Class Constants
public static final int REGISTRY_PORT = 1099;
// Public Instance Methods
public void bind(String name, Remote obj) throws RemoteException,
AlreadyBoundException, AccessException;
public String[] list() throws RemoteException, AccessException;
public Remote lookup(String name)
throws RemoteException, NotBoundException, AccessException;
public void rebind(String name, Remote obj)
throws RemoteException, AccessException;
public void unbind(String name) throws RemoteException,
NotBoundException, AccessException;
}