jdk/src/java.rmi/share/classes/java/rmi/registry/LocateRegistry.java
author martin
Thu, 30 Oct 2014 07:31:41 -0700
changeset 28059 e576535359cc
parent 25859 3317bb8137f4
permissions -rw-r--r--
8067377: My hobby: caning, then then canning, the the can-can Summary: Fix ALL the stutters! Reviewed-by: rriggs, mchung, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4512
diff changeset
     2
 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4512
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4512
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4512
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4512
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4512
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.rmi.registry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.rmi.RemoteException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.rmi.server.ObjID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.rmi.server.RMIClientSocketFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.rmi.server.RMIServerSocketFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.rmi.server.RemoteRef;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.rmi.server.UnicastRemoteObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.rmi.registry.RegistryImpl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.rmi.server.UnicastRef2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.rmi.server.UnicastRef;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import sun.rmi.server.Util;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import sun.rmi.transport.LiveRef;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import sun.rmi.transport.tcp.TCPEndpoint;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <code>LocateRegistry</code> is used to obtain a reference to a bootstrap
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * remote object registry on a particular host (including the local host), or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * to create a remote object registry that accepts calls on a specific port.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <p> Note that a <code>getRegistry</code> call does not actually make a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * connection to the remote host.  It simply creates a local reference to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * the remote registry and will succeed even if no registry is running on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * the remote host.  Therefore, a subsequent method invocation to a remote
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * registry returned as a result of this method may fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @author  Ann Wollrath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @author  Peter Jones
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
    54
 * @since   1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @see     java.rmi.registry.Registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
public final class LocateRegistry {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * Private constructor to disable public construction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private LocateRegistry() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
    65
     * Returns a reference to the remote object <code>Registry</code> for
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * the local host on the default registry port of 1099.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @return reference (a stub) to the remote object registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @exception RemoteException if the reference could not be created
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
    70
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public static Registry getRegistry()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        throws RemoteException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        return getRegistry(null, Registry.REGISTRY_PORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    /**
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
    79
     * Returns a reference to the remote object <code>Registry</code> for
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * the local host on the specified <code>port</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @param port port on which the registry accepts requests
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @return reference (a stub) to the remote object registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @exception RemoteException if the reference could not be created
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
    85
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public static Registry getRegistry(int port)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        throws RemoteException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        return getRegistry(null, port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * Returns a reference to the remote object <code>Registry</code> on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * specified <code>host</code> on the default registry port of 1099.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * <code>host</code> is <code>null</code>, the local host is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @param host host for the remote registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @return reference (a stub) to the remote object registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @exception RemoteException if the reference could not be created
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   101
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    public static Registry getRegistry(String host)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        throws RemoteException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        return getRegistry(host, Registry.REGISTRY_PORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Returns a reference to the remote object <code>Registry</code> on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * specified <code>host</code> and <code>port</code>. If <code>host</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * is <code>null</code>, the local host is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @param host host for the remote registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @param port port on which the registry accepts requests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @return reference (a stub) to the remote object registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @exception RemoteException if the reference could not be created
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   118
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    public static Registry getRegistry(String host, int port)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        throws RemoteException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        return getRegistry(host, port, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * Returns a locally created remote reference to the remote object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * <code>Registry</code> on the specified <code>host</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * <code>port</code>.  Communication with this remote registry will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * use the supplied <code>RMIClientSocketFactory</code> <code>csf</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * to create <code>Socket</code> connections to the registry on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * remote <code>host</code> and <code>port</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @param host host for the remote registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @param port port on which the registry accepts requests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @param csf  client-side <code>Socket</code> factory used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     *      make connections to the registry.  If <code>csf</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *      is null, then the default client-side <code>Socket</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *      factory will be used in the registry stub.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @return reference (a stub) to the remote registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * @exception RemoteException if the reference could not be created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    public static Registry getRegistry(String host, int port,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                                       RMIClientSocketFactory csf)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        throws RemoteException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        Registry registry = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        if (port <= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            port = Registry.REGISTRY_PORT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        if (host == null || host.length() == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            // If host is blank (as returned by "file:" URL in 1.0.2 used in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            // java.rmi.Naming), try to convert to real local host name so
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            // that the RegistryImpl's checkAccess will not fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                host = java.net.InetAddress.getLocalHost().getHostAddress();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                // If that failed, at least try "" (localhost) anyway...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                host = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
         * Create a proxy for the registry with the given host, port, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
         * client socket factory.  If the supplied client socket factory is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
         * null, then the ref type is a UnicastRef, otherwise the ref type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
         * is a UnicastRef2.  If the property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
         * java.rmi.server.ignoreStubClasses is true, then the proxy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
         * returned is an instance of a dynamic proxy class that implements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
         * the Registry interface; otherwise the proxy returned is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
         * instance of the pregenerated stub class for RegistryImpl.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
         **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        LiveRef liveRef =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            new LiveRef(new ObjID(ObjID.REGISTRY_ID),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                        new TCPEndpoint(host, port, csf, null),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                        false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        RemoteRef ref =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            (csf == null) ? new UnicastRef(liveRef) : new UnicastRef2(liveRef);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        return (Registry) Util.createProxy(RegistryImpl.class, ref, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Creates and exports a <code>Registry</code> instance on the local
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * host that accepts requests on the specified <code>port</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * <p>The <code>Registry</code> instance is exported as if the static
4512
b3ed7ecf8f55 6909563: Javadoc build warnings in rmi, security, management
darcy
parents: 2
diff changeset
   190
     * {@link UnicastRemoteObject#exportObject(Remote,int)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * UnicastRemoteObject.exportObject} method is invoked, passing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * <code>Registry</code> instance and the specified <code>port</code> as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * arguments, except that the <code>Registry</code> instance is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * exported with a well-known object identifier, an {@link ObjID}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * instance constructed with the value {@link ObjID#REGISTRY_ID}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @param port the port on which the registry accepts requests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @return the registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * @exception RemoteException if the registry could not be exported
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   200
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public static Registry createRegistry(int port) throws RemoteException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        return new RegistryImpl(port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * Creates and exports a <code>Registry</code> instance on the local
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * host that uses custom socket factories for communication with that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * instance.  The registry that is created listens for incoming
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * requests on the given <code>port</code> using a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * <code>ServerSocket</code> created from the supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * <code>RMIServerSocketFactory</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * <p>The <code>Registry</code> instance is exported as if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * the static {@link
4512
b3ed7ecf8f55 6909563: Javadoc build warnings in rmi, security, management
darcy
parents: 2
diff changeset
   216
     * UnicastRemoteObject#exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * UnicastRemoteObject.exportObject} method is invoked, passing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * <code>Registry</code> instance, the specified <code>port</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * specified <code>RMIClientSocketFactory</code>, and the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * <code>RMIServerSocketFactory</code> as arguments, except that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * <code>Registry</code> instance is exported with a well-known object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * identifier, an {@link ObjID} instance constructed with the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * {@link ObjID#REGISTRY_ID}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @param port port on which the registry accepts requests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * @param csf  client-side <code>Socket</code> factory used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *      make connections to the registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * @param ssf  server-side <code>ServerSocket</code> factory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *      used to accept connections to the registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * @return the registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @exception RemoteException if the registry could not be exported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    public static Registry createRegistry(int port,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                                          RMIClientSocketFactory csf,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                                          RMIServerSocketFactory ssf)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        throws RemoteException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        return new RegistryImpl(port, csf, ssf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
}