--- old/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIJRMPServerImpl.java 2017-02-02 11:15:03.000000000 +0000 +++ /dev/null 2017-02-02 11:15:03.000000000 +0000 @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package javax.management.remote.rmi; - -import java.io.IOException; -import java.rmi.NoSuchObjectException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.server.RMIClientSocketFactory; -import java.rmi.server.RMIServerSocketFactory; -import java.rmi.server.UnicastRemoteObject; -import java.rmi.server.RemoteObject; -import java.util.Map; -import java.util.Collections; -import javax.security.auth.Subject; - -import com.sun.jmx.remote.internal.RMIExporter; -import com.sun.jmx.remote.util.EnvHelp; -import java.io.ObjectStreamClass; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import sun.reflect.misc.ReflectUtil; -import sun.rmi.server.DeserializationChecker; -import sun.rmi.server.UnicastServerRef; -import sun.rmi.server.UnicastServerRef2; - -/** - *
An {@link RMIServer} object that is exported through JRMP and that - * creates client connections as RMI objects exported through JRMP. - * User code does not usually reference this class directly.
- * - * @see RMIServerImpl - * - * @since 1.5 - */ -public class RMIJRMPServerImpl extends RMIServerImpl { - - private final ExportedWrapper exportedWrapper; - - /** - *Creates a new {@link RMIServer} object that will be exported - * on the given port using the given socket factories.
- * - * @param port the port on which this object and the {@link - * RMIConnectionImpl} objects it creates will be exported. Can be - * zero, to indicate any available port. - * - * @param csf the client socket factory for the created RMI - * objects. Can be null. - * - * @param ssf the server socket factory for the created RMI - * objects. Can be null. - * - * @param env the environment map. Can be null. - * - * @exception IOException if the {@link RMIServer} object - * cannot be created. - * - * @exception IllegalArgumentException ifport
is
- * negative.
- */
- public RMIJRMPServerImpl(int port,
- RMIClientSocketFactory csf,
- RMIServerSocketFactory ssf,
- MapReturns a serializable stub for this {@link RMIServer} object.
- * - * @return a serializable stub. - * - * @exception IOException if the stub cannot be obtained - e.g the - * RMIJRMPServerImpl has not been exported yet. - */ - public Remote toStub() throws IOException { - if (exportedWrapper != null) { - return RemoteObject.toStub(exportedWrapper); - } else { - return RemoteObject.toStub(this); - } - } - - /** - *Creates a new client connection as an RMI object exported
- * through JRMP. The port and socket factories for the new
- * {@link RMIConnection} object are the ones supplied
- * to the RMIJRMPServerImpl
constructor.
RMIConnection
.
- *
- * @exception IOException if the new {@link RMIConnection}
- * object cannot be created or exported.
- */
- protected RMIConnection makeClient(String connectionId, Subject subject)
- throws IOException {
-
- if (connectionId == null)
- throw new NullPointerException("Null connectionId");
-
- RMIConnection client =
- new RMIConnectionImpl(this, connectionId, getDefaultClassLoader(),
- subject, env);
- export(client);
- return client;
- }
-
- protected void closeClient(RMIConnection client) throws IOException {
- unexport(client, true);
- }
-
- /**
- * Called by {@link #close()} to close the connector server by - * unexporting this object. After returning from this method, the - * connector server must not accept any new connections.
- * - * @exception IOException if the attempt to close the connector - * server failed. - */ - protected void closeServer() throws IOException { - if (exportedWrapper != null) { - unexport(exportedWrapper, true); - } else { - unexport(this, true); - } - } - - private final int port; - private final RMIClientSocketFactory csf; - private final RMIServerSocketFactory ssf; - private final MapAn {@link RMIServer} object that is exported through JRMP and that + * creates client connections as RMI objects exported through JRMP. + * User code does not usually reference this class directly.
+ * + * @see RMIServerImpl + * + * @since 1.5 + */ +public class RMIJRMPServerImpl extends RMIServerImpl { + + private final ExportedWrapper exportedWrapper; + + /** + *Creates a new {@link RMIServer} object that will be exported + * on the given port using the given socket factories.
+ * + * @param port the port on which this object and the {@link + * RMIConnectionImpl} objects it creates will be exported. Can be + * zero, to indicate any available port. + * + * @param csf the client socket factory for the created RMI + * objects. Can be null. + * + * @param ssf the server socket factory for the created RMI + * objects. Can be null. + * + * @param env the environment map. Can be null. + * + * @exception IOException if the {@link RMIServer} object + * cannot be created. + * + * @exception IllegalArgumentException ifport
is
+ * negative.
+ */
+ public RMIJRMPServerImpl(int port,
+ RMIClientSocketFactory csf,
+ RMIServerSocketFactory ssf,
+ MapReturns a serializable stub for this {@link RMIServer} object.
+ * + * @return a serializable stub. + * + * @exception IOException if the stub cannot be obtained - e.g the + * RMIJRMPServerImpl has not been exported yet. + */ + public Remote toStub() throws IOException { + if (exportedWrapper != null) { + return RemoteObject.toStub(exportedWrapper); + } else { + return RemoteObject.toStub(this); + } + } + + /** + *Creates a new client connection as an RMI object exported
+ * through JRMP. The port and socket factories for the new
+ * {@link RMIConnection} object are the ones supplied
+ * to the RMIJRMPServerImpl
constructor.
RMIConnection
.
+ *
+ * @exception IOException if the new {@link RMIConnection}
+ * object cannot be created or exported.
+ */
+ protected RMIConnection makeClient(String connectionId, Subject subject)
+ throws IOException {
+
+ if (connectionId == null)
+ throw new NullPointerException("Null connectionId");
+
+ RMIConnection client =
+ new RMIConnectionImpl(this, connectionId, getDefaultClassLoader(),
+ subject, env);
+ export(client);
+ return client;
+ }
+
+ protected void closeClient(RMIConnection client) throws IOException {
+ unexport(client, true);
+ }
+
+ /**
+ * Called by {@link #close()} to close the connector server by + * unexporting this object. After returning from this method, the + * connector server must not accept any new connections.
+ * + * @exception IOException if the attempt to close the connector + * server failed. + */ + protected void closeServer() throws IOException { + if (exportedWrapper != null) { + unexport(exportedWrapper, true); + } else { + unexport(this, true); + } + } + + private final int port; + private final RMIClientSocketFactory csf; + private final RMIServerSocketFactory ssf; + private final Map