Name

Registry

Synopsis

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 lookup 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(0 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 {
// Public Constants
   public static final int REGISTRY_PORT;                        // =1099
                  // Public Instance Methods
   public abstract void bind(String name, 
        Remote obj) throws RemoteException, AlreadyBoundException, AccessException;  
   public abstract String[] list( ) throws RemoteExceptionAccessException; ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.