-
- All Superinterfaces:
- Remote
public interface Registry extends Remote
Registryis 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, andrebindmethods are used to alter the name bindings in the registry, and thelookupandlistmethods are used to query the current name bindings.In its typical usage, a
Registryenables 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-knownObjIDand TCP port number (default is1099).The
LocateRegistryclass provides a programmatic API for constructing a bootstrap reference to aRegistryat a remote address (see the staticgetRegistrymethods) and for creating and exporting aRegistryin the current VM on a particular local address (see the staticcreateRegistrymethods).A
Registryimplementation 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 aRegistrymethod chooses to deny access for a given invocation, its implementation may throwAccessException, which (because it extendsRemoteException) will be wrapped in aServerExceptionwhen caught by a remote client.The names used for bindings in a
Registryare pure strings, not parsed. A service which stores its remote reference in aRegistrymay 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 intREGISTRY_PORTWell known port for registry.
-
Method Summary
Methods Modifier and Type Method and Description voidbind(String name, Remote obj)Binds a remote reference to the specifiednamein this registry.String[]list()Returns an array of the names bound in this registry.Remotelookup(String name)Returns the remote reference bound to the specifiednamein this registry.voidrebind(String name, Remote obj)Replaces the binding for the specifiednamein this registry with the supplied remote reference.voidunbind(String name)Removes the binding for the specifiednamein 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 specifiednamein this registry.- Parameters:
name- the name for the remote reference to look up- Returns:
- a reference to a remote object
- Throws:
NotBoundException- ifnameis not currently boundRemoteException- if remote communication with the registry failed; if exception is aServerExceptioncontaining 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- ifnameisnull
-
bind
void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException
Binds a remote reference to the specifiednamein this registry.- Parameters:
name- the name to associate with the remote referenceobj- a reference to a remote object (usually a stub)- Throws:
AlreadyBoundException- ifnameis already boundRemoteException- if remote communication with the registry failed; if exception is aServerExceptioncontaining 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- ifnameisnull, or ifobjisnull
-
unbind
void unbind(String name) throws RemoteException, NotBoundException, AccessException
Removes the binding for the specifiednamein this registry.- Parameters:
name- the name of the binding to remove- Throws:
NotBoundException- ifnameis not currently boundRemoteException- if remote communication with the registry failed; if exception is aServerExceptioncontaining 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- ifnameisnull
-
rebind
void rebind(String name, Remote obj) throws RemoteException, AccessException
Replaces the binding for the specifiednamein 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 aServerExceptioncontaining 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- ifnameisnull, or ifobjisnull
-
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 aServerExceptioncontaining 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
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/rmi/registry/Registry.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.