Chapter 16. The java.rmi.registry PackageThe java.rmi.registry package contains classes that provide an interface and an implementation for the various elements of the RMI object naming registry. Figure 16-1 shows the class hierarchy for this package. Figure 16-1. The java.rmi.registry package
This class provides a low-level interface to an RMI registry service, residing either on the local host or on a remote server. On an object lookup, the Naming service parses the host and port from the remote object URL and uses methods of LocateRegistry to connect to the remote registry. The various getRegistry() methods provide the means to get a reference to the local registry or a stub to a remote registry running on a given host and port. The createRegistry() methods create a registry running on the local host on the given port number. The second form of the createRegistry() method allows you to specify custom socket factories the registry uses when it communicates with clients and server objects.
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 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 class, 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 finds objects by name in the Registry, while the list() method gets a list of the names of all objects currently in the Registry.
Hierarchy: (Registry(Remote)) Returned By: LocateRegistry.{createRegistry(), getRegistry()}, RegistryHandler.{registryImpl(), registryStub()}
This interface is mainly of interest to implementors of RMI registry services. It defines the interface to the internal registry-handling implementation.
Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|