CONTENTS | PREV | NEXT Java Remote Method Invocation


6.2 The LocateRegistry Class

The class java.rmi.registry.LocateRegistry contains static methods that return a reference to a registry on the current host, current host at specified port, a specified host or at a particular port on a specified host. What is returned is the remote stub for the registry with the specified host and port information. No remote operations need be performed to obtain a reference (stub) for any registry on any host.

package java.rmi.registry;
public final class LocateRegistry {
public static Registry getRegistry()
throws java.rmi.RemoteException;

public static Registry getRegistry(int port)
throws java.rmi.RemoteException;

public static Registry getRegistry(String host)
throws java.rmi.RemoteException,
java.rmi.UnknownHostException;

public static Registry getRegistry(String host, int port)
throws java.rmi.RemoteException,
java.rmi.UnknownHostException;

public static Registry createRegistry(int port)
throws java.rmi.RemoteException;
}
The createRegistry method creates and exports a registry on the local host on the specified port. The registry implements a simple flat naming syntax that binds the name of a remote object (a string) to a remote object reference. The name and remote object bindings are not remembered across server restarts.


Note - Starting a registry with the createRegistry method does not keep the server process alive.


CONTENTS | PREV | NEXT
Copyright © 1997-1998 Sun Microsystems, Inc. All Rights Reserved.