-
- All Superinterfaces:
- Remote
public interface Registry extends Remote
Registry
is a remote interface to a simple remote object registry that provides methods for storing and retrieving remote object references bound with arbitrary string names. Thebind
,unbind
, andrebind
methods are used to alter the name bindings in the registry, and thelookup
andlist
methods are used to query the current name bindings.In its typical usage, a
Registry
enables RMI client bootstrapping: it provides a simple means for a client to obtain an initial reference to a remote object. Therefore, a registry's remote object implementation is typically exported with a well-known address, such as with a well-knownObjID
and TCP port number (default is1099
).The
LocateRegistry
class provides a programmatic API for constructing a bootstrap reference to aRegistry
at a remote address (see the staticgetRegistry
methods) and for creating and exporting aRegistry
in the current VM on a particular local address (see the staticcreateRegistry
methods).A
Registry
implementation may choose to restrict access to some or all of its methods (for example, methods that mutate the registry's bindings may be restricted to calls originating from the local host). If aRegistry
method chooses to deny access for a given invocation, its implementation may throwAccessException
, which (because it extendsRemoteException
) will be wrapped in aServerException
when caught by a remote client.The names used for bindings in a
Registry
are pure strings, not parsed. A service which stores its remote reference in aRegistry
may wish to use a package name as a prefix in the name binding to reduce the likelihood of name collisions in the registry.- Since:
- JDK1.1
- See Also:
LocateRegistry
-
-
Field Summary
Fields Modifier and Type Field and Description static int
REGISTRY_PORT
Well known port for registry.
-
Method Summary
Methods Modifier and Type Method and Description void
bind(String name, Remote obj)
Binds a remote reference to the specifiedname
in this registry.String[]
list()
Returns an array of the names bound in this registry.Remote
lookup(String name)
Returns the remote reference bound to the specifiedname
in this registry.void
rebind(String name, Remote obj)
Replaces the binding for the specifiedname
in this registry with the supplied remote reference.void
unbind(String name)
Removes the binding for the specifiedname
in this registry.
-
-
-
Field Detail
-
REGISTRY_PORT
static final int REGISTRY_PORT
Well known port for registry.- See Also:
- Constant Field Values
-
-
Method Detail
-
lookup
Remote lookup(String name) throws RemoteException, NotBoundException, AccessException
Returns the remote reference bound to the specifiedname
in this registry.- Parameters:
name
- the name for the remote reference to look up- Returns:
- a reference to a remote object
- Throws:
NotBoundException
- ifname
is not currently boundRemoteException
- if remote communication with the registry failed; if exception is aServerException
containing anAccessException
, then the registry denies the caller access to perform this operationAccessException
- if this registry is local and it denies the caller access to perform this operationNullPointerException
- ifname
isnull
-
bind
void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException
Binds a remote reference to the specifiedname
in this registry.- Parameters:
name
- the name to associate with the remote referenceobj
- a reference to a remote object (usually a stub)- Throws:
AlreadyBoundException
- ifname
is already boundRemoteException
- if remote communication with the registry failed; if exception is aServerException
containing anAccessException
, then the registry denies the caller access to perform this operation (if originating from a non-local host, for example)AccessException
- if this registry is local and it denies the caller access to perform this operationNullPointerException
- ifname
isnull
, or ifobj
isnull
-
unbind
void unbind(String name) throws RemoteException, NotBoundException, AccessException
Removes the binding for the specifiedname
in this registry.- Parameters:
name
- the name of the binding to remove- Throws:
NotBoundException
- ifname
is not currently boundRemoteException
- if remote communication with the registry failed; if exception is aServerException
containing anAccessException
, then the registry denies the caller access to perform this operation (if originating from a non-local host, for example)AccessException
- if this registry is local and it denies the caller access to perform this operationNullPointerException
- ifname
isnull
-
rebind
void rebind(String name, Remote obj) throws RemoteException, AccessException
Replaces the binding for the specifiedname
in this registry with the supplied remote reference. If there is an existing binding for the specifiedname
, it is discarded.- Parameters:
name
- the name to associate with the remote referenceobj
- a reference to a remote object (usually a stub)- Throws:
RemoteException
- if remote communication with the registry failed; if exception is aServerException
containing anAccessException
, then the registry denies the caller access to perform this operation (if originating from a non-local host, for example)AccessException
- if this registry is local and it denies the caller access to perform this operationNullPointerException
- ifname
isnull
, or ifobj
isnull
-
list
String[] list() throws RemoteException, AccessException
Returns an array of the names bound in this registry. The array will contain a snapshot of the names bound in this registry at the time of the given invocation of this method.- Returns:
- an array of the names bound in this registry
- Throws:
RemoteException
- if remote communication with the registry failed; if exception is aServerException
containing anAccessException
, then the registry denies the caller access to perform this operationAccessException
- if this registry is local and it denies the caller access to perform this operation
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/11/2024 21:51:21 Cette version de la page est en cache (à la date du 21/11/2024 21:51:21) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 30/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/rmi/registry/registry.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.