src/share/classes/java/rmi/registry/LocateRegistry.java

Print this page




 170          * java.rmi.server.ignoreStubClasses is true, then the proxy
 171          * returned is an instance of a dynamic proxy class that implements
 172          * the Registry interface; otherwise the proxy returned is an
 173          * instance of the pregenerated stub class for RegistryImpl.
 174          **/
 175         LiveRef liveRef =
 176             new LiveRef(new ObjID(ObjID.REGISTRY_ID),
 177                         new TCPEndpoint(host, port, csf, null),
 178                         false);
 179         RemoteRef ref =
 180             (csf == null) ? new UnicastRef(liveRef) : new UnicastRef2(liveRef);
 181 
 182         return (Registry) Util.createProxy(RegistryImpl.class, ref, false);
 183     }
 184 
 185     /**
 186      * Creates and exports a <code>Registry</code> instance on the local
 187      * host that accepts requests on the specified <code>port</code>.
 188      *
 189      * <p>The <code>Registry</code> instance is exported as if the static
 190      * {@link UnicastRemoteObject.exportObject(Remote,int)
 191      * UnicastRemoteObject.exportObject} method is invoked, passing the
 192      * <code>Registry</code> instance and the specified <code>port</code> as
 193      * arguments, except that the <code>Registry</code> instance is
 194      * exported with a well-known object identifier, an {@link ObjID}
 195      * instance constructed with the value {@link ObjID#REGISTRY_ID}.
 196      *
 197      * @param port the port on which the registry accepts requests
 198      * @return the registry
 199      * @exception RemoteException if the registry could not be exported
 200      * @since JDK1.1
 201      **/
 202     public static Registry createRegistry(int port) throws RemoteException {
 203         return new RegistryImpl(port);
 204     }
 205 
 206     /**
 207      * Creates and exports a <code>Registry</code> instance on the local
 208      * host that uses custom socket factories for communication with that
 209      * instance.  The registry that is created listens for incoming
 210      * requests on the given <code>port</code> using a
 211      * <code>ServerSocket</code> created from the supplied
 212      * <code>RMIServerSocketFactory</code>.
 213      *
 214      * <p>The <code>Registry</code> instance is exported as if
 215      * the static {@link
 216      * UnicastRemoteObject.exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory)
 217      * UnicastRemoteObject.exportObject} method is invoked, passing the
 218      * <code>Registry</code> instance, the specified <code>port</code>, the
 219      * specified <code>RMIClientSocketFactory</code>, and the specified
 220      * <code>RMIServerSocketFactory</code> as arguments, except that the
 221      * <code>Registry</code> instance is exported with a well-known object
 222      * identifier, an {@link ObjID} instance constructed with the value
 223      * {@link ObjID#REGISTRY_ID}.
 224      *
 225      * @param port port on which the registry accepts requests
 226      * @param csf  client-side <code>Socket</code> factory used to
 227      *      make connections to the registry
 228      * @param ssf  server-side <code>ServerSocket</code> factory
 229      *      used to accept connections to the registry
 230      * @return the registry
 231      * @exception RemoteException if the registry could not be exported
 232      * @since 1.2
 233      **/
 234     public static Registry createRegistry(int port,
 235                                           RMIClientSocketFactory csf,
 236                                           RMIServerSocketFactory ssf)


 170          * java.rmi.server.ignoreStubClasses is true, then the proxy
 171          * returned is an instance of a dynamic proxy class that implements
 172          * the Registry interface; otherwise the proxy returned is an
 173          * instance of the pregenerated stub class for RegistryImpl.
 174          **/
 175         LiveRef liveRef =
 176             new LiveRef(new ObjID(ObjID.REGISTRY_ID),
 177                         new TCPEndpoint(host, port, csf, null),
 178                         false);
 179         RemoteRef ref =
 180             (csf == null) ? new UnicastRef(liveRef) : new UnicastRef2(liveRef);
 181 
 182         return (Registry) Util.createProxy(RegistryImpl.class, ref, false);
 183     }
 184 
 185     /**
 186      * Creates and exports a <code>Registry</code> instance on the local
 187      * host that accepts requests on the specified <code>port</code>.
 188      *
 189      * <p>The <code>Registry</code> instance is exported as if the static
 190      * {@link UnicastRemoteObject#exportObject(Remote,int)
 191      * UnicastRemoteObject.exportObject} method is invoked, passing the
 192      * <code>Registry</code> instance and the specified <code>port</code> as
 193      * arguments, except that the <code>Registry</code> instance is
 194      * exported with a well-known object identifier, an {@link ObjID}
 195      * instance constructed with the value {@link ObjID#REGISTRY_ID}.
 196      *
 197      * @param port the port on which the registry accepts requests
 198      * @return the registry
 199      * @exception RemoteException if the registry could not be exported
 200      * @since JDK1.1
 201      **/
 202     public static Registry createRegistry(int port) throws RemoteException {
 203         return new RegistryImpl(port);
 204     }
 205 
 206     /**
 207      * Creates and exports a <code>Registry</code> instance on the local
 208      * host that uses custom socket factories for communication with that
 209      * instance.  The registry that is created listens for incoming
 210      * requests on the given <code>port</code> using a
 211      * <code>ServerSocket</code> created from the supplied
 212      * <code>RMIServerSocketFactory</code>.
 213      *
 214      * <p>The <code>Registry</code> instance is exported as if
 215      * the static {@link
 216      * UnicastRemoteObject#exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory)
 217      * UnicastRemoteObject.exportObject} method is invoked, passing the
 218      * <code>Registry</code> instance, the specified <code>port</code>, the
 219      * specified <code>RMIClientSocketFactory</code>, and the specified
 220      * <code>RMIServerSocketFactory</code> as arguments, except that the
 221      * <code>Registry</code> instance is exported with a well-known object
 222      * identifier, an {@link ObjID} instance constructed with the value
 223      * {@link ObjID#REGISTRY_ID}.
 224      *
 225      * @param port port on which the registry accepts requests
 226      * @param csf  client-side <code>Socket</code> factory used to
 227      *      make connections to the registry
 228      * @param ssf  server-side <code>ServerSocket</code> factory
 229      *      used to accept connections to the registry
 230      * @return the registry
 231      * @exception RemoteException if the registry could not be exported
 232      * @since 1.2
 233      **/
 234     public static Registry createRegistry(int port,
 235                                           RMIClientSocketFactory csf,
 236                                           RMIServerSocketFactory ssf)