public class

RegistryImpl

extends RemoteServer
implements Registry
java.lang.Object
   ↳ java.rmi.server.RemoteObject
     ↳ java.rmi.server.RemoteServer
       ↳ sun.rmi.registry.RegistryImpl
Known Direct Subclasses

Class Overview

A "registry" exists on every node that allows RMI connections to servers on that node. The registry on a particular node contains a transient database that maps names to remote objects. When the node boots, the registry database is empty. The names stored in the registry are pure and are not parsed. A service storing itself in the registry may want to prefix its name of the service by a package name (although not required), to reduce name collisions in the registry. The LocateRegistry class is used to obtain registry for different hosts.

See Also

Summary

[Expand]
Inherited Constants
From interface java.rmi.registry.Registry
[Expand]
Inherited Fields
From class java.rmi.server.RemoteObject
Public Constructors
RegistryImpl(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf)
Construct a new RegistryImpl on the specified port with the given custom socket factory pair.
RegistryImpl(int port)
Construct a new RegistryImpl on the specified port.
Public Methods
void bind(String name, Remote obj)
Binds the name to the specified remote object.
static void checkAccess(String op)
Check that the caller has access to perform indicated operation.
static ObjID getID()
String[] list()
Returns an enumeration of the names in the registry.
Remote lookup(String name)
Returns the remote object for specified name in the registry.
static void main(String[] args)
Main program to start a registry.
void rebind(String name, Remote obj)
Rebind the name to a new object, replaces any existing binding.
void unbind(String name)
Unbind the name.
[Expand]
Inherited Methods
From class java.rmi.server.RemoteServer
From class java.rmi.server.RemoteObject
From class java.lang.Object
From interface java.rmi.registry.Registry

Public Constructors

public RegistryImpl (int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf)

Construct a new RegistryImpl on the specified port with the given custom socket factory pair.

public RegistryImpl (int port)

Construct a new RegistryImpl on the specified port.

Public Methods

public void bind (String name, Remote obj)

Binds the name to the specified remote object.

Parameters
name the name to associate with the remote reference
obj a reference to a remote object (usually a stub)
Throws
RemoteException If remote operation failed.
AlreadyBoundException If name is already bound.
AccessException

public static void checkAccess (String op)

Check that the caller has access to perform indicated operation. The client must be on same the same host as this server.

public static ObjID getID ()

public String[] list ()

Returns an enumeration of the names in the registry.

Returns
  • an array of the names bound in this registry
Throws
RemoteException If remote operation failed.

public Remote lookup (String name)

Returns the remote object for specified name in the registry.

Parameters
name the name for the remote reference to look up
Returns
  • a reference to a remote object
Throws
RemoteException If remote operation failed.
If name is not currently bound.
NotBoundException

public static void main (String[] args)

Main program to start a registry.
The port number can be specified on the command line.

public void rebind (String name, Remote obj)

Rebind the name to a new object, replaces any existing binding.

Parameters
name the name to associate with the remote reference
obj a reference to a remote object (usually a stub)
Throws
RemoteException If remote operation failed.
AccessException

public void unbind (String name)

Unbind the name.

Parameters
name the name of the binding to remove
Throws
RemoteException If remote operation failed.
If name is not currently bound.
AccessException
NotBoundException