Top Description Fields Constructors Methods
sun.rmi.registry

public Class RegistryImpl

extends RemoteServer
implements Registry
Class Inheritance
All Implemented Interfaces
java.rmi.registry.Registry, java.rmi.Remote
Imports
java.io.ObjectInputFilter, .File, .FilePermission, .IOException, java.nio.file.Path, .Paths, java.security.PrivilegedAction, .Security, .AccessControlContext, .AccessController, .CodeSource, .Policy, .PrivilegedActionException, .PrivilegedExceptionAction, .PermissionCollection, .Permissions, .ProtectionDomain, java.util.ArrayList, .Enumeration, .Hashtable, .List, .MissingResourceException, .ResourceBundle, java.net.*, java.rmi.*, java.rmi.server.ObjID, .ServerNotActiveException, .RMIClientSocketFactory, .RMIServerSocketFactory, java.rmi.registry.Registry, java.text.MessageFormat, jdk.internal.access.SharedSecrets, sun.rmi.runtime.Log, sun.rmi.server.UnicastRef, .UnicastServerRef, .UnicastServerRef2, sun.rmi.transport.LiveRef

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.

The default RegistryImpl exported restricts access to clients on the local host for the methods bind, rebind, unbind by checking the client host in the skeleton.

See Also
java.rmi.registry.LocateRegistry

Field Summary

Modifier and TypeField and Description
private static Hashtable<InetAddress, InetAddress>
private Hashtable<String, Remote>
private static ObjID
private static RegistryImpl
private static final String
REGISTRY_FILTER_PROPNAME

Property name of the RMI Registry serial filter to augment the built-in list of allowed types.

private static final int
REGISTRY_MAX_ARRAY_SIZE

Registry maximum array size in remote invocations.

private static final int
REGISTRY_MAX_DEPTH

Registry max depth of remote invocations.

private static final ObjectInputFilter
registryFilter

The registryFilter created from the value of the "sun.rmi.registry.registryFilter" property.

private static ResourceBundle
private static final long

Constructor Summary

AccessConstructor and Description
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, RMIClientSocketFactory csf, RMIServerSocketFactory ssf, ObjectInputFilter serialFilter)

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

public
RegistryImpl(int port)

Construct a new RegistryImpl on the specified port.

Method Summary

Modifier and TypeMethod and Description
public void
bind(String
the name to associate with the remote reference
name
,
Remote
a reference to a remote object (usually a stub)
obj
)

Implements java.rmi.registry.Registry.bind.

Binds the name to the specified remote object.

public static void
checkAccess(String op)

Check that the caller has access to perform indicated operation.

public static RegistryImpl

Returns:

a RegistryImpl instance
createRegistry
(int
port on which the rmiregistry accepts requests; if 0, an implementation specific port is assigned
regPort
)

Return a new RegistryImpl on the requested port and export it to serve registry requests.

private static AccessControlContext
getAccessControlContext(int port)
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

Generates an AccessControlContext with minimal permissions.

public static ObjID
private static String
getTextResource(String key)

Retrieves text resources from the locale-specific properties file.

private static ObjectInputFilter

Returns:

an ObjectInputFilter, or null
initRegistryFilter
()

Initialize the registryFilter from the security properties or system property; if any

public String[]
list()

Implements java.rmi.registry.Registry.list.

Returns an enumeration of the names in the registry.

public Remote
lookup(String
the name for the remote reference to look up
name
)

Implements java.rmi.registry.Registry.lookup.

Returns the remote object for specified name in the registry.

public static void
main(String[] args)

Main program to start a registry.

private static URL[]
pathToURLs(String path)

Convert class path specification into an array of file URLs.

public void
rebind(String
the name to associate with the remote reference
name
,
Remote
a reference to a remote object (usually a stub)
obj
)

Implements java.rmi.registry.Registry.rebind.

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

private static ObjectInputFilter.Status
registryFilter(ObjectInputFilter.FilterInfo
access to the class, array length, etc.
filterInfo
)

ObjectInputFilter to filter Registry input objects.

private void
setup(UnicastServerRef uref)
References Deprecated UnicastServerRef is deprecated or references (maybe indirectly) at least one deprecated element.

public void
unbind(String
the name of the binding to remove
name
)

Implements java.rmi.registry.Registry.unbind.

Unbind the name.

Inherited from java.rmi.server.RemoteServer:
getClientHostgetLogsetLog

Field Detail

allowedAccessCacheback to summary
private static Hashtable<InetAddress, InetAddress> allowedAccessCache
bindingsback to summary
private Hashtable<String, Remote> bindings
idback to summary
private static ObjID id
registryback to summary
private static RegistryImpl registry
REGISTRY_FILTER_PROPNAMEback to summary
private static final String REGISTRY_FILTER_PROPNAME

Property name of the RMI Registry serial filter to augment the built-in list of allowed types. Setting the property in the conf/security/java.security file will enable the augmented filter.

REGISTRY_MAX_ARRAY_SIZEback to summary
private static final int REGISTRY_MAX_ARRAY_SIZE

Registry maximum array size in remote invocations.

REGISTRY_MAX_DEPTHback to summary
private static final int REGISTRY_MAX_DEPTH

Registry max depth of remote invocations.

registryFilterback to summary
private static final ObjectInputFilter registryFilter

The registryFilter created from the value of the "sun.rmi.registry.registryFilter" property.

Annotations
@SuppressWarnings:removal
resourcesback to summary
private static ResourceBundle resources
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.rmi.server.RemoteServer.serialVersionUID.

Constructor Detail

RegistryImplback to summary
public RegistryImpl(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException

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

RegistryImplback to summary
public RegistryImpl(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf, ObjectInputFilter serialFilter) throws RemoteException

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

Annotations
@SuppressWarnings:removal
RegistryImplback to summary
public RegistryImpl(int port) throws RemoteException

Construct a new RegistryImpl on the specified port.

Annotations
@SuppressWarnings:removal

Method Detail

bindback to summary
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException

Implements java.rmi.registry.Registry.bind.

Binds the name to the specified remote object.

Parameters
name:String

Doc from java.rmi.registry.Registry.bind.

the name to associate with the remote reference

obj:Remote

Doc from java.rmi.registry.Registry.bind.

a reference to a remote object (usually a stub)

Exceptions
RemoteException:
If remote operation failed.
AlreadyBoundException:
If name is already bound.
AccessException:

Doc from java.rmi.registry.Registry.bind.

if this registry is local and it denies the caller access to perform this operation

checkAccessback to summary
public static void checkAccess(String op) throws AccessException

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

Annotations
@SuppressWarnings:removal
createRegistryback to summary
public static RegistryImpl createRegistry(int regPort) throws RemoteException

Return a new RegistryImpl on the requested port and export it to serve registry requests. A classloader is initialized from the system property "env.class.path" and a security manager is set unless one is already set.

The returned Registry is fully functional within the current process and is usable for internal and testing purposes.

Parameters
regPort:int

port on which the rmiregistry accepts requests; if 0, an implementation specific port is assigned

Returns:RegistryImpl

a RegistryImpl instance

Annotations
@SuppressWarnings:removal
Exceptions
RemoteException:
If remote operation failed.
Since
9
getAccessControlContextback to summary
private static AccessControlContext getAccessControlContext(int port)

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Generates an AccessControlContext with minimal permissions. The approach used here is taken from the similar method getAccessControlContext() in the sun.applet.AppletPanel class.

Annotations
@SuppressWarnings:removal
getIDback to summary
public static ObjID getID()
getTextResourceback to summary
private static String getTextResource(String key)

Retrieves text resources from the locale-specific properties file.

initRegistryFilterback to summary
private static ObjectInputFilter initRegistryFilter()

Initialize the registryFilter from the security properties or system property; if any

Returns:ObjectInputFilter

an ObjectInputFilter, or null

Annotations
@SuppressWarnings:deprecation
listback to summary
public String[] list() throws RemoteException

Implements java.rmi.registry.Registry.list.

Returns an enumeration of the names in the registry.

Returns:String[]

Doc from java.rmi.registry.Registry.list.

an array of the names bound in this registry

Exceptions
RemoteException:
If remote operation failed.
lookupback to summary
public Remote lookup(String name) throws RemoteException, NotBoundException

Implements java.rmi.registry.Registry.lookup.

Returns the remote object for specified name in the registry.

Parameters
name:String

Doc from java.rmi.registry.Registry.lookup.

the name for the remote reference to look up

Returns:Remote

Doc from java.rmi.registry.Registry.lookup.

a reference to a remote object

Exceptions
RemoteException:
If remote operation failed.
NotBoundException:
If name is not currently bound.
mainback to summary
public static void main(String[] args)

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

pathToURLsback to summary
private static URL[] pathToURLs(String path)

Convert class path specification into an array of file URLs. The path of the file is converted to a URI then into URL form so that reserved characters can safely appear in the path.

rebindback to summary
public void rebind(String name, Remote obj) throws RemoteException, AccessException

Implements java.rmi.registry.Registry.rebind.

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

Parameters
name:String

Doc from java.rmi.registry.Registry.rebind.

the name to associate with the remote reference

obj:Remote

Doc from java.rmi.registry.Registry.rebind.

a reference to a remote object (usually a stub)

Exceptions
RemoteException:
If remote operation failed.
AccessException:

Doc from java.rmi.registry.Registry.rebind.

if this registry is local and it denies the caller access to perform this operation

registryFilterback to summary
private static ObjectInputFilter.Status registryFilter(ObjectInputFilter.FilterInfo filterInfo)

ObjectInputFilter to filter Registry input objects. The list of acceptable classes is limited to classes normally stored in a registry.

Parameters
filterInfo:ObjectInputFilter.FilterInfo

access to the class, array length, etc.

Returns:ObjectInputFilter.Status

ObjectInputFilter.Status#ALLOWED if allowed, ObjectInputFilter.Status#REJECTED if rejected, otherwise ObjectInputFilter.Status#UNDECIDED

Annotations
@SuppressWarnings:removal
setupback to summary
private void setup(UnicastServerRef uref) throws RemoteException

References Deprecated

UnicastServerRef is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

unbindback to summary
public void unbind(String name) throws RemoteException, NotBoundException, AccessException

Implements java.rmi.registry.Registry.unbind.

Unbind the name.

Parameters
name:String

Doc from java.rmi.registry.Registry.unbind.

the name of the binding to remove

Exceptions
RemoteException:
If remote operation failed.
NotBoundException:
If name is not currently bound.
AccessException:

Doc from java.rmi.registry.Registry.unbind.

if this registry is local and it denies the caller access to perform this operation