O'Reilly logo

Java RMI by William Grosso

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The RMI Registry Is an RMI Server

The RMI registry is implemented as an RMI server. Underlying Naming’s static methods is an interface that extends Remote and an implementation of that interface. In Java 2, these are:

The java.rmi.registry.Registry interface

This extends Remote and defines the methods an implementation of Registry must implement.

The sun.rmi.registry.RegistryImpl implementation class

This is an actual RMI server that implements the Registry interface.

The Registry interface is straightforward. It defines five methods, each of which maps directly to one of the static methods defined in Naming:

public interface Registry extends Remote {
	public static final int REGISTRY_PORT = 1099;
	public Remote lookup(String name) throws RemoteException, NotBoundException,
         AccessException;
	public void bind(String name, Remote obj) throws RemoteException,
         AlreadyBoundException, AccessException;
	public void unbind(String name) throws RemoteException, NotBoundException,
         AccessException;
	public void rebind(String name, Remote obj) throws RemoteException,
         AccessException;
	public String[] list(  ) throws RemoteException, AccessException;
}

Bootstrapping the Registry

Given that the RMI registry is an RMI server, with both an interface and an implementation, many people wonder why Naming was defined. Why go through the trouble of making static methods that simply redirect to a standard implementation?

The answer is that we use Naming and the static methods because the bootstrapping ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required