当前页面: 
在线文档首页 > 
JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档
Class java.rmi.registry.LocateRegistry - JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class java.rmi.registry.LocateRegistry
java.lang.Object
   |
   +----java.rmi.registry.LocateRegistry
  -  public final class LocateRegistry
  -  extends Object
This class is used to obtain the bootstrap Registry on a particular
 host (including your local host). The following example demonstrates usage
 (minus exception handling):
 
 Server wishes to make itself available to others:
	
 SomeService service = ...; // remote object for service
	
 Registry registry = LocateRegistry.getRegistry();
	
 registry.bind("I Serve", service);
 
 The client wishes to make requests of the above service:
	
 Registry registry = LocateRegistry.getRegistry("foo.services.com");
	
 SomeService service = (SomeService)registry.lookup("I Serve");
	
 service.requestService(...);
    -  See Also:
    
-  Registry
   
  -   createRegistry(int) createRegistry(int)
-   Create and export a registry on the local host.
  
-   getRegistry() getRegistry()
-   Returns the remote object Registry for the local host.
  
-   getRegistry(int) getRegistry(int)
-   Returns the remote object Registry on the current host at the
 specified port.
  
-   getRegistry(String) getRegistry(String)
-   Returns the remote object Registry on the specified host at a
 default (i.e., well-known) port number.
  
-   getRegistry(String, int) getRegistry(String, int)
-   Returns the remote object Registry on the specified host at the
 specified port.
   
 getRegistry
getRegistry
 public static Registry getRegistry() throws RemoteException
  -  Returns the remote object Registry for the local host.
 
 getRegistry
getRegistry
 public static Registry getRegistry(int port) throws RemoteException
  -  Returns the remote object Registry on the current host at the
 specified port.
 
 getRegistry
getRegistry
 public static Registry getRegistry(String host) throws RemoteException, UnknownHostException
  -  Returns the remote object Registry on the specified host at a
 default (i.e., well-known) port number.  If the host
 Stringreference isnull, the local
 host is used.
 
 getRegistry
getRegistry
 public static Registry getRegistry(String host,
                                    int port) throws RemoteException, UnknownHostException
  -  Returns the remote object Registry on the specified host at the
 specified port.  If port <= 0, the default Registry port number
 is used.  If the host Stringreference isnull, the local host is used.
   
- 
    -  Throws: UnknownHostException
    
-  If the host is not known.
  
 
 createRegistry
createRegistry
 public static Registry createRegistry(int port) throws RemoteException
  -  Create and export a registry on the local host.
   
- 
    -  Parameters:
    
-  port - the port on which the registry is to be exported
    
-  Throws: RemoteException
    
-  If failure occurs during remote
 object creation.
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index
Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems,  Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A.  All Rights Reserved.