From 8339b30ae2d56ed27c8d4f220230977d09fca2f1 Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik
Date: Tue, 3 Mar 2015 18:19:41 +0100
Subject: [PATCH 1/3] 8043937: Drop support for the IIOP transport from the JMX
RMIConnector
Reviewed-by: alanb, erikj
---
jdk/make/netbeans/jmx/build.xml | 42 +-
jdk/make/rmic/Rmic-java.management.gmk | 43 +-
.../sun/jmx/remote/internal/IIOPHelper.java | 190 --------
.../sun/jmx/remote/internal/IIOPProxy.java | 110 -----
.../remote/protocol/iiop/ClientProvider.java | 48 --
.../remote/protocol/iiop/IIOPProxyImpl.java | 157 -------
.../protocol/iiop/ProxyInputStream.java | 241 ----------
.../remote/protocol/iiop/ServerProvider.java | 51 ---
.../remote/JMXConnectorFactory.java | 6 +-
.../remote/JMXConnectorServerFactory.java | 6 +-
.../remote/rmi/NoCallStackClassLoader.java | 13 +-
.../remote/rmi/RMIConnectionImpl.java | 7 +-
.../management/remote/rmi/RMIConnector.java | 414 +-----------------
.../remote/rmi/RMIConnectorServer.java | 92 +---
.../remote/rmi/RMIIIOPServerImpl.java | 104 +----
.../management/remote/rmi/RMIServerImpl.java | 7 +-
.../javax/management/remote/rmi/package.html | 99 +----
.../mandatory/connection/CloseableTest.java | 2 -
.../remote/mandatory/connection/NoIIOP.java | 142 ------
19 files changed, 105 insertions(+), 1669 deletions(-)
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java
delete mode 100644 jdk/test/javax/management/remote/mandatory/connection/NoIIOP.java
diff --git a/jdk/make/netbeans/jmx/build.xml b/jdk/make/netbeans/jmx/build.xml
index 09c2cb25fb6..34e200f7190 100644
--- a/jdk/make/netbeans/jmx/build.xml
+++ b/jdk/make/netbeans/jmx/build.xml
@@ -63,8 +63,8 @@
-
@@ -90,44 +90,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jdk/make/rmic/Rmic-java.management.gmk b/jdk/make/rmic/Rmic-java.management.gmk
index 57b1d221ad8..9eca430ed63 100644
--- a/jdk/make/rmic/Rmic-java.management.gmk
+++ b/jdk/make/rmic/Rmic-java.management.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -32,38 +32,31 @@ include RmicCommon.gmk
# Generate RMI stubs
#
-# For RMI/IIOP call rmic a second time with -standardPackage option
-# so that *_tie classes are generated in package without the prefix
-# org.omg.stub (6375696)
JMX_RMI_CLASSES := javax.management.remote.rmi.RMIConnectionImpl \
javax.management.remote.rmi.RMIServerImpl
-GENRMIIIOPCLASSES :=
-ifneq ($(RMICONNECTOR_IIOP), false)
- GENRMIIIOPCLASSES := $(RMICONNECTOR_IIOP)
-endif
-$(eval $(call SetupRMICompilation,RMI_IIOP, \
- CLASSES := $(JMX_RMI_CLASSES), \
- CLASSES_DIR := $(CLASSES_DIR)/java.management, \
- STUB_CLASSES_DIR := $(STUB_CLASSES_DIR)/java.management, \
- RUN_V12 := true, \
- RUN_IIOP := $(GENRMIIIOPCLASSES), \
- RUN_IIOP_STDPKG := $(GENRMIIIOPCLASSES)))
-# Keep generated RMI/JRMP Stub source files and copy them to RMIC_GENSRC_DIR
-# so that javadoc can include them in the API (4997471)
-$(eval $(call SetupRMICompilation,RMI_SRC, \
+# Generate into gensrc dir where sources get picked up for javadoc, then move the classes
+# into the stub classes dir.
+$(eval $(call SetupRMICompilation,RMI_GEN, \
CLASSES := $(JMX_RMI_CLASSES), \
CLASSES_DIR := $(CLASSES_DIR)/java.management, \
- STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR)/java.management, \
+ STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR), \
RUN_V12 := true, \
- KEEP_GENERATED := true))
+ KEEP_GENERATED := true, \
+))
+
+# Find all classes generated and move them from the gensrc dir to the stub classes dir
+$(RMIC_GENSRC_DIR)/_classes.moved: $(RMI_GEN)
+ $(eval classfiles := $(shell $(FIND) $(RMIC_GENSRC_DIR) -name "*.class"))
+ $(foreach src, $(classfiles), \
+ $(eval target := $(patsubst $(RMIC_GENSRC_DIR)/%, \
+ $(STUB_CLASSES_DIR)/java.management/%, $(src))) \
+ $(MKDIR) -p $(dir $(target)) ; \
+ $(MV) $(src) $(target) $(NEWLINE))
+ $(TOUCH) $@
##########################################################################################
-$(RMIC_GENSRC_DIR)/_the.classes.removed: $(RMI_IIOP) $(RMI_SRC)
- $(FIND) $(RMIC_GENSRC_DIR) -name "*.class" $(FIND_DELETE)
- $(TOUCH) $@
-
-all: $(RMIC_GENSRC_DIR)/_the.classes.removed $(RMI_IIOP) $(RMI_SRC)
+all: $(RMIC_GENSRC_DIR)/_classes.moved $(RMI_GEN)
.PHONY: all
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java
deleted file mode 100644
index eabe73962c2..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2009, 2012, 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 com.sun.jmx.remote.internal;
-
-import java.util.Properties;
-import java.io.IOException;
-import java.rmi.Remote;
-import java.rmi.NoSuchObjectException;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * A helper class for RMI-IIOP and CORBA APIs.
- */
-
-public final class IIOPHelper {
- private IIOPHelper() { }
-
- // loads IIOPProxy implementation class if available
- private static final String IMPL_CLASS =
- "com.sun.jmx.remote.protocol.iiop.IIOPProxyImpl";
- private static final IIOPProxy proxy =
- AccessController.doPrivileged(new PrivilegedAction() {
- public IIOPProxy run() {
- try {
- Class> c = Class.forName(IMPL_CLASS, true,
- IIOPHelper.class.getClassLoader());
- return (IIOPProxy)c.newInstance();
- } catch (ClassNotFoundException cnf) {
- return null;
- } catch (InstantiationException e) {
- throw new AssertionError(e);
- } catch (IllegalAccessException e) {
- throw new AssertionError(e);
- }
- }});
-
- /**
- * Returns true if RMI-IIOP and CORBA is available.
- */
- public static boolean isAvailable() {
- return proxy != null;
- }
-
- private static void ensureAvailable() {
- if (proxy == null)
- throw new AssertionError("Should not here");
- }
-
- /**
- * Returns true if the given object is a Stub.
- */
- public static boolean isStub(Object obj) {
- return (proxy == null) ? false : proxy.isStub(obj);
- }
-
- /**
- * Returns the Delegate to which the given Stub delegates.
- */
- public static Object getDelegate(Object stub) {
- ensureAvailable();
- return proxy.getDelegate(stub);
- }
-
- /**
- * Sets the Delegate for a given Stub.
- */
- public static void setDelegate(Object stub, Object delegate) {
- ensureAvailable();
- proxy.setDelegate(stub, delegate);
- }
-
- /**
- * Returns the ORB associated with the given stub
- *
- * @throws UnsupportedOperationException
- * if the object does not support the operation that
- * was invoked
- */
- public static Object getOrb(Object stub) {
- ensureAvailable();
- return proxy.getOrb(stub);
- }
-
- /**
- * Connects the Stub to the given ORB.
- */
- public static void connect(Object stub, Object orb)
- throws IOException
- {
- if (proxy == null)
- throw new IOException("Connection to ORB failed, RMI/IIOP not available");
- proxy.connect(stub, orb);
- }
-
- /**
- * Returns true if the given object is an ORB.
- */
- public static boolean isOrb(Object obj) {
- return (proxy == null) ? false : proxy.isOrb(obj);
- }
-
- /**
- * Creates, and returns, a new ORB instance.
- */
- public static Object createOrb(String[] args, Properties props)
- throws IOException
- {
- if (proxy == null)
- throw new IOException("ORB initialization failed, RMI/IIOP not available");
- return proxy.createOrb(args, props);
- }
-
- /**
- * Converts a string, produced by the object_to_string method, back
- * to a CORBA object reference.
- */
- public static Object stringToObject(Object orb, String str) {
- ensureAvailable();
- return proxy.stringToObject(orb, str);
- }
-
- /**
- * Converts the given CORBA object reference to a string.
- */
- public static String objectToString(Object orb, Object obj) {
- ensureAvailable();
- return proxy.objectToString(orb, obj);
- }
-
- /**
- * Checks to ensure that an object of a remote or abstract interface
- * type can be cast to a desired type.
- */
- public static T narrow(Object narrowFrom, Class narrowTo) {
- ensureAvailable();
- return proxy.narrow(narrowFrom, narrowTo);
- }
-
- /**
- * Makes a server object ready to receive remote calls
- */
- public static void exportObject(Remote obj) throws IOException {
- if (proxy == null)
- throw new IOException("RMI object cannot be exported, RMI/IIOP not available");
- proxy.exportObject(obj);
- }
-
- /**
- * Deregisters a server object from the runtime.
- */
- public static void unexportObject(Remote obj) throws IOException {
- if (proxy == null)
- throw new NoSuchObjectException("Object not exported");
- proxy.unexportObject(obj);
- }
-
- /**
- * Returns a stub for the given server object.
- */
- public static Remote toStub(Remote obj) throws IOException {
- if (proxy == null)
- throw new NoSuchObjectException("Object not exported");
- return proxy.toStub(obj);
- }
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java
deleted file mode 100644
index b7e2ef6fe4c..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2009, 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 com.sun.jmx.remote.internal;
-
-import java.util.Properties;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.NoSuchObjectException;
-
-/**
- * An interface to a subset of the RMI-IIOP and CORBA APIs to avoid a
- * static dependencies on the types defined by these APIs.
- */
-
-public interface IIOPProxy {
-
- /**
- * Returns true if the given object is a Stub.
- */
- boolean isStub(Object obj);
-
- /**
- * Returns the Delegate to which the given Stub delegates.
- */
- Object getDelegate(Object stub);
-
- /**
- * Sets the Delegate for a given Stub.
- */
- void setDelegate(Object stub, Object delegate);
-
- /**
- * Returns the ORB associated with the given stub
- *
- * @throws UnsupportedOperationException
- * if the object does not support the operation that
- * was invoked
- */
- Object getOrb(Object stub);
-
- /**
- * Connects the Stub to the given ORB.
- */
- void connect(Object stub, Object orb) throws RemoteException;
-
- /**
- * Returns true if the given object is an ORB.
- */
- boolean isOrb(Object obj);
-
- /**
- * Creates, and returns, a new ORB instance.
- */
- Object createOrb(String[] args, Properties props);
-
- /**
- * Converts a string, produced by the object_to_string method, back
- * to a CORBA object reference.
- */
- Object stringToObject(Object orb, String str);
-
- /**
- * Converts the given CORBA object reference to a string.
- */
- String objectToString(Object orb, Object obj);
-
- /**
- * Checks to ensure that an object of a remote or abstract interface
- * type can be cast to a desired type.
- */
- T narrow(Object narrowFrom, Class narrowTo);
-
- /**
- * Makes a server object ready to receive remote calls
- */
- void exportObject(Remote obj) throws RemoteException;
-
- /**
- * Deregisters a server object from the runtime.
- */
- void unexportObject(Remote obj) throws NoSuchObjectException;
-
- /**
- * Returns a stub for the given server object.
- */
- Remote toStub(Remote obj) throws NoSuchObjectException;
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java
deleted file mode 100644
index eeeb6715982..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, 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 com.sun.jmx.remote.protocol.iiop;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import javax.management.remote.JMXConnectorProvider;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.rmi.RMIConnector;
-
-public class ClientProvider implements JMXConnectorProvider {
-
- public JMXConnector newJMXConnector(JMXServiceURL serviceURL,
- Map environment)
- throws IOException {
- if (!serviceURL.getProtocol().equals("iiop")) {
- throw new MalformedURLException("Protocol not iiop: " +
- serviceURL.getProtocol());
- }
- return new RMIConnector(serviceURL, environment);
- }
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java
deleted file mode 100644
index b0fe91bf728..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2009,2013, 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 com.sun.jmx.remote.protocol.iiop;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.portable.Delegate;
-import javax.rmi.PortableRemoteObject;
-import javax.rmi.CORBA.Stub;
-
-import java.util.Properties;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.NoSuchObjectException;
-
-import com.sun.jmx.remote.internal.IIOPProxy;
-import java.io.SerializablePermission;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.Permissions;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.security.ProtectionDomain;
-
-/**
- * An implementation of IIOPProxy that simply delegates to the appropriate
- * RMI-IIOP and CORBA APIs.
- */
-
-public class IIOPProxyImpl implements IIOPProxy {
- // special ACC used to initialize the IIOP stub
- // the only allowed privilege is SerializablePermission("enableSubclassImplementation")
- private static final AccessControlContext STUB_ACC;
-
- static {
- Permissions p = new Permissions();
- p.add(new SerializablePermission("enableSubclassImplementation"));
- STUB_ACC = new AccessControlContext(
- new ProtectionDomain[]{
- new ProtectionDomain(null, p)
- }
- );
- }
-
- public IIOPProxyImpl() { }
-
- @Override
- public boolean isStub(Object obj) {
- return (obj instanceof Stub);
- }
-
- @Override
- public Object getDelegate(Object stub) {
- return ((Stub)stub)._get_delegate();
- }
-
- @Override
- public void setDelegate(Object stub, Object delegate) {
- ((Stub)stub)._set_delegate((Delegate)delegate);
- }
-
- @Override
- public Object getOrb(Object stub) {
- try {
- return ((Stub)stub)._orb();
- } catch (org.omg.CORBA.BAD_OPERATION x) {
- throw new UnsupportedOperationException(x);
- }
- }
-
- @Override
- public void connect(Object stub, Object orb)
- throws RemoteException
- {
- ((Stub)stub).connect((ORB)orb);
- }
-
- @Override
- public boolean isOrb(Object obj) {
- return (obj instanceof ORB);
- }
-
- @Override
- public Object createOrb(String[] args, Properties props) {
- return ORB.init(args, props);
- }
-
- @Override
- public Object stringToObject(Object orb, String str) {
- return ((ORB)orb).string_to_object(str);
- }
-
- @Override
- public String objectToString(Object orb, Object obj) {
- return ((ORB)orb).object_to_string((org.omg.CORBA.Object)obj);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T narrow(Object narrowFrom, Class narrowTo) {
- return (T)PortableRemoteObject.narrow(narrowFrom, narrowTo);
- }
-
- @Override
- public void exportObject(Remote obj) throws RemoteException {
- PortableRemoteObject.exportObject(obj);
- }
-
- @Override
- public void unexportObject(Remote obj) throws NoSuchObjectException {
- PortableRemoteObject.unexportObject(obj);
- }
-
- @Override
- public Remote toStub(final Remote obj) throws NoSuchObjectException {
- if (System.getSecurityManager() == null) {
- return PortableRemoteObject.toStub(obj);
- } else {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction() {
-
- @Override
- public Remote run() throws Exception {
- return PortableRemoteObject.toStub(obj);
- }
- }, STUB_ACC);
- } catch (PrivilegedActionException e) {
- if (e.getException() instanceof NoSuchObjectException) {
- throw (NoSuchObjectException)e.getException();
- }
- throw new RuntimeException("Unexpected exception type", e.getException());
- }
- }
- }
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java
deleted file mode 100644
index e7fda6098eb..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2003, 2008, 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 com.sun.jmx.remote.protocol.iiop;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.portable.BoxedValueHelper;
-
-@SuppressWarnings({"deprecation", "rawtypes"})
-public class ProxyInputStream extends org.omg.CORBA_2_3.portable.InputStream {
- public ProxyInputStream(org.omg.CORBA.portable.InputStream in) {
- this.in = in;
- }
-
- public boolean read_boolean() {
- return in.read_boolean();
- }
-
- public char read_char() {
- return in.read_char();
- }
-
- public char read_wchar() {
- return in.read_wchar();
- }
-
- public byte read_octet() {
- return in.read_octet();
- }
-
- public short read_short() {
- return in.read_short();
- }
-
- public short read_ushort() {
- return in.read_ushort();
- }
-
- public int read_long() {
- return in.read_long();
- }
-
- public int read_ulong() {
- return in.read_ulong();
- }
-
- public long read_longlong() {
- return in.read_longlong();
- }
-
- public long read_ulonglong() {
- return in.read_ulonglong();
- }
-
- public float read_float() {
- return in.read_float();
- }
-
- public double read_double() {
- return in.read_double();
- }
-
- public String read_string() {
- return in.read_string();
- }
-
- public String read_wstring() {
- return in.read_wstring();
- }
-
- public void read_boolean_array(boolean[] value, int offset, int length) {
- in.read_boolean_array(value, offset, length);
- }
-
- public void read_char_array(char[] value, int offset, int length) {
- in.read_char_array(value, offset, length);
- }
-
- public void read_wchar_array(char[] value, int offset, int length) {
- in.read_wchar_array(value, offset, length);
- }
-
- public void read_octet_array(byte[] value, int offset, int length) {
- in.read_octet_array(value, offset, length);
- }
-
- public void read_short_array(short[] value, int offset, int length) {
- in.read_short_array(value, offset, length);
- }
-
- public void read_ushort_array(short[] value, int offset, int length) {
- in.read_ushort_array(value, offset, length);
- }
-
- public void read_long_array(int[] value, int offset, int length) {
- in.read_long_array(value, offset, length);
- }
-
- public void read_ulong_array(int[] value, int offset, int length) {
- in.read_ulong_array(value, offset, length);
- }
-
- public void read_longlong_array(long[] value, int offset, int length) {
- in.read_longlong_array(value, offset, length);
- }
-
- public void read_ulonglong_array(long[] value, int offset, int length) {
- in.read_ulonglong_array(value, offset, length);
- }
-
- public void read_float_array(float[] value, int offset, int length) {
- in.read_float_array(value, offset, length);
- }
-
- public void read_double_array(double[] value, int offset, int length) {
- in.read_double_array(value, offset, length);
- }
-
- public org.omg.CORBA.Object read_Object() {
- return in.read_Object();
- }
-
- public TypeCode read_TypeCode() {
- return in.read_TypeCode();
- }
-
- public Any read_any() {
- return in.read_any();
- }
-
- /**
- * @deprecated
- */
- @Override
- @Deprecated
- public org.omg.CORBA.Principal read_Principal() {
- return in.read_Principal();
- }
-
- @Override
- public int read() throws IOException {
- return in.read();
- }
-
- @Override
- public BigDecimal read_fixed() {
- return in.read_fixed();
- }
-
- @Override
- public Context read_Context() {
- return in.read_Context();
- }
-
- @Override
- public org.omg.CORBA.Object read_Object(java.lang.Class clz) {
- return in.read_Object(clz);
- }
-
- @Override
- public ORB orb() {
- return in.orb();
- }
-
- @Override
- public Serializable read_value() {
- return narrow().read_value();
- }
-
- @Override
- public Serializable read_value(Class clz) {
- return narrow().read_value(clz);
- }
-
- @Override
- public Serializable read_value(BoxedValueHelper factory) {
- return narrow().read_value(factory);
- }
-
- @Override
- public Serializable read_value(String rep_id) {
- return narrow().read_value(rep_id);
- }
-
- @Override
- public Serializable read_value(Serializable value) {
- return narrow().read_value(value);
- }
-
- @Override
- public Object read_abstract_interface() {
- return narrow().read_abstract_interface();
- }
-
- @Override
- public Object read_abstract_interface(Class clz) {
- return narrow().read_abstract_interface(clz);
- }
-
- protected org.omg.CORBA_2_3.portable.InputStream narrow() {
- if (in instanceof org.omg.CORBA_2_3.portable.InputStream)
- return (org.omg.CORBA_2_3.portable.InputStream) in;
- throw new NO_IMPLEMENT();
- }
-
- public org.omg.CORBA.portable.InputStream getProxiedInputStream() {
- return in;
- }
-
- protected final org.omg.CORBA.portable.InputStream in;
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java
deleted file mode 100644
index 2f248f52a0e..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, 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 com.sun.jmx.remote.protocol.iiop;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.remote.JMXConnectorServer;
-import javax.management.remote.JMXConnectorServerProvider;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.rmi.RMIConnectorServer;
-
-public class ServerProvider implements JMXConnectorServerProvider {
-
- public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
- Map environment,
- MBeanServer mbeanServer)
- throws IOException {
- if (!serviceURL.getProtocol().equals("iiop")) {
- throw new MalformedURLException("Protocol not iiop: " +
- serviceURL.getProtocol());
- }
- return new RMIConnectorServer(serviceURL, environment, mbeanServer);
- }
-
-}
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java
index 2eb99d2b870..1458aca4c3b 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -140,9 +140,7 @@ import sun.reflect.misc.ReflectUtil;
*
*
Every implementation must support the RMI connector protocol with
* the default RMI transport, specified with string rmi.
- * An implementation may optionally support the RMI connector protocol
- * with the RMI/IIOP transport, specified with the string
- * iiop.
+ *
*
*
Once a provider is found, the result of the
* newJMXConnector method is the result of calling {@link
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java
index bdaa4e7f1fd..2bfae84c688 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -131,9 +131,7 @@ import javax.management.MBeanServer;
*
*
Every implementation must support the RMI connector protocol with
* the default RMI transport, specified with string rmi.
- * An implementation may optionally support the RMI connector protocol
- * with the RMI/IIOP transport, specified with the string
- * iiop.
+ *
*
*
Once a provider is found, the result of the
* newJMXConnectorServer method is the result of calling
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
index e8addac66fe..8a0882f5369 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -31,12 +31,11 @@ import java.security.ProtectionDomain;
A class loader that only knows how to define a limited number
of classes, and load a limited number of other classes through
delegation to another loader. It is used to get around a problem
- with Serialization, in particular as used by RMI (including
- RMI/IIOP). The JMX Remote API defines exactly what class loader
- must be used to deserialize arguments on the server, and return
- values on the client. We communicate this class loader to RMI by
- setting it as the context class loader. RMI uses the context
- class loader to load classes as it deserializes, which is what we
+ with Serialization, in particular as used by RMI. The JMX Remote API
+ defines exactly what class loader must be used to deserialize arguments on
+ the server, and return values on the client. We communicate this class
+ loader to RMI by setting it as the context class loader. RMI uses the
+ context class loader to load classes as it deserializes, which is what we
want. However, before consulting the context class loader, it
looks up the call stack for a class with a non-null class loader,
and uses that if it finds one. So, in the standalone version of
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
index 5fb3c9d0508..dd050e4ef9c 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -76,11 +76,10 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
/**
* Constructs a new {@link RMIConnection}. This connection can be
- * used with either the JRMP or IIOP transport. This object does
+ * used with the JRMP transport. This object does
* not export itself: it is the responsibility of the caller to
* export it appropriately (see {@link
- * RMIJRMPServerImpl#makeClient(String,Subject)} and {@link
- * RMIIIOPServerImpl#makeClient(String,Subject)}.
+ * RMIJRMPServerImpl#makeClient(String,Subject)}).
*
* @param rmiServer The RMIServerImpl object for which this
* connection is created. The behavior is unspecified if this
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
index 9f256481711..4bd796e3e7a 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -30,25 +30,21 @@ import com.sun.jmx.remote.internal.ClientCommunicatorAdmin;
import com.sun.jmx.remote.internal.ClientListenerInfo;
import com.sun.jmx.remote.internal.ClientNotifForwarder;
import com.sun.jmx.remote.internal.ProxyRef;
-import com.sun.jmx.remote.internal.IIOPHelper;
import com.sun.jmx.remote.util.ClassLogger;
import com.sun.jmx.remote.util.EnvHelp;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InvalidObjectException;
-import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.io.Serializable;
-import java.io.WriteAbortedException;
import java.lang.ref.WeakReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
-import java.rmi.MarshalException;
import java.rmi.MarshalledObject;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
@@ -61,13 +57,12 @@ import java.rmi.server.RemoteRef;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
import java.security.ProtectionDomain;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Hashtable;
import java.util.Map;
-import java.util.Properties;
import java.util.Set;
import java.util.WeakHashMap;
import javax.management.Attribute;
@@ -146,22 +141,20 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* the RMI connector server with the given address.
*
*
The address can refer directly to the connector server,
- * using one of the following syntaxes:
An implementation may also recognize additional address
@@ -242,8 +235,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
/**
* @throws IOException if the connection could not be made because of a
- * communication problem, or in the case of the {@code iiop} protocol,
- * that RMI/IIOP is not supported
+ * communication problem
*/
public void connect() throws IOException {
connect(null);
@@ -251,8 +243,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
/**
* @throws IOException if the connection could not be made because of a
- * communication problem, or in the case of the {@code iiop} protocol,
- * that RMI/IIOP is not supported
+ * communication problem
*/
public synchronized void connect(Map environment)
throws IOException {
@@ -294,9 +285,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
if (checkStub) checkStub(stub, rmiServerImplStubClass);
- // Connect IIOP Stub if needed.
if (tracing) logger.trace("connect",idstr + " connecting stub...");
- stub = connectStub(stub,usemap);
idstr = (tracing?"["+this.toString()+"]":null);
// Calling newClient on the RMIServer stub.
@@ -307,18 +296,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
try {
connection = getConnection(stub, credentials, checkStub);
} catch (java.rmi.RemoteException re) {
- if (jmxServiceURL != null) {
- final String pro = jmxServiceURL.getProtocol();
- final String path = jmxServiceURL.getURLPath();
-
- if ("rmi".equals(pro) &&
- path.startsWith("/jndi/iiop:")) {
- MalformedURLException mfe = new MalformedURLException(
- "Protocol is rmi but JNDI scheme is iiop: " + jmxServiceURL);
- mfe.initCause(re);
- throw mfe;
- }
- }
throw re;
}
@@ -1413,13 +1390,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
if (ioe instanceof UnmarshalException) {
throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
// fetch one by one with UnmarshalException
- } else if (ioe instanceof MarshalException) {
- // IIOP will throw MarshalException wrapping a NotSerializableException
- // when a server fails to serialize a response.
- MarshalException me = (MarshalException)ioe;
- if (me.detail instanceof NotSerializableException) {
- throw (NotSerializableException)me.detail;
- }
}
// Not serialization problem, return.
@@ -1654,9 +1624,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
throw new IOException("Failed to get a RMI stub: "+ne);
}
- // Connect IIOP Stub if needed.
- stub = connectStub(stub,env);
-
// Calling newClient on the RMIServer stub.
Object credentials = env.get(CREDENTIALS);
connection = stub.newClient(credentials);
@@ -1693,103 +1660,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
//--------------------------------------------------------------------
// Private stuff - Serialization
//--------------------------------------------------------------------
- /**
- *
In order to be usable, an IIOP stub must be connected to an ORB.
- * The stub is automatically connected to the ORB if:
- *
- *
It was returned by the COS naming
- *
Its server counterpart has been registered in COS naming
- * through JNDI.
- *
- * Otherwise, it is not connected. A stub which is deserialized
- * from Jini is not connected. A stub which is obtained from a
- * non registered RMIIIOPServerImpl is not a connected.
- * A stub which is not connected can't be serialized, and thus
- * can't be registered in Jini. A stub which is not connected can't
- * be used to invoke methods on the server.
- *
- * In order to palliate this, this method will connect the
- * given stub if it is not yet connected. If the given
- * RMIServer is not an instance of
- * {@link javax.rmi.CORBA.Stub javax.rmi.CORBA.Stub}, then the
- * method do nothing and simply returns that stub. Otherwise,
- * this method will attempt to connect the stub to an ORB as
- * follows:
- *
- *
This method looks in the provided environment for
- * the "java.naming.corba.orb" property. If it is found, the
- * referenced object (an {@link org.omg.CORBA.ORB ORB}) is used to
- * connect the stub. Otherwise, a new org.omg.CORBA.ORB is created
- * by calling {@link
- * org.omg.CORBA.ORB#init(String[], Properties)
- * org.omg.CORBA.ORB.init((String[])null,(Properties)null)}
- *
The new created ORB is kept in a static
- * {@link WeakReference} and can be reused for connecting other
- * stubs. However, no reference is ever kept on the ORB provided
- * in the environment map, if any.
- *
- * @param rmiServer A RMI Server Stub.
- * @param environment An environment map, possibly containing an ORB.
- * @return the given stub.
- * @exception IllegalArgumentException if the
- * {@code java.naming.corba.orb} property is specified and
- * does not point to an {@link org.omg.CORBA.ORB ORB}.
- * @exception IOException if the connection to the ORB failed.
- **/
- static RMIServer connectStub(RMIServer rmiServer,
- Map environment)
- throws IOException {
- if (IIOPHelper.isStub(rmiServer)) {
- try {
- IIOPHelper.getOrb(rmiServer);
- } catch (UnsupportedOperationException x) {
- // BAD_OPERATION
- IIOPHelper.connect(rmiServer, resolveOrb(environment));
- }
- }
- return rmiServer;
- }
-
- /**
- * Get the ORB specified by environment, or create a
- * new one.
- *
This method looks in the provided environment for
- * the "java.naming.corba.orb" property. If it is found, the
- * referenced object (an {@link org.omg.CORBA.ORB ORB}) is
- * returned. Otherwise, a new org.omg.CORBA.ORB is created
- * by calling {@link
- * org.omg.CORBA.ORB#init(String[], java.util.Properties)
- * org.omg.CORBA.ORB.init((String[])null,(Properties)null)}
- *
The new created ORB is kept in a static
- * {@link WeakReference} and can be reused for connecting other
- * stubs. However, no reference is ever kept on the ORB provided
- * in the environment map, if any.
- * @param environment An environment map, possibly containing an ORB.
- * @return An ORB.
- * @exception IllegalArgumentException if the
- * {@code java.naming.corba.orb} property is specified and
- * does not point to an {@link org.omg.CORBA.ORB ORB}.
- * @exception IOException if the ORB initialization failed.
- **/
- static Object resolveOrb(Map environment)
- throws IOException {
- if (environment != null) {
- final Object orb = environment.get(EnvHelp.DEFAULT_ORB);
- if (orb != null && !(IIOPHelper.isOrb(orb)))
- throw new IllegalArgumentException(EnvHelp.DEFAULT_ORB +
- " must be an instance of org.omg.CORBA.ORB.");
- if (orb != null) return orb;
- }
- final Object orb =
- (RMIConnector.orb==null)?null:RMIConnector.orb.get();
- if (orb != null) return orb;
-
- final Object newOrb =
- IIOPHelper.createOrb((String[])null, (Properties)null);
- RMIConnector.orb = new WeakReference
+ * rmi are described in the package documentation for
+ * {@link javax.management.remote.rmi}.
*
*
The behavior when the URL path is neither empty nor a JNDI
- * directory URL, or when the protocol is neither rmi
- * nor iiop, is implementation defined, and may
- * include throwing {@link MalformedURLException} when the
- * connector server is created or when it is started.
+ * directory URL, or when the protocol is not rmi,
+ * is implementation defined, and may include throwing
+ * {@link MalformedURLException} when the connector server is created
+ * or when it is started.
*
* @exception IllegalStateException if the connector server has
* not been attached to an MBean server.
* @exception IOException if the connector server cannot be
- * started, or in the case of the {@code iiop} protocol, that
- * RMI/IIOP is not supported.
+ * started.
*/
public synchronized void start() throws IOException {
final boolean tracing = logger.traceOn();
@@ -649,16 +641,13 @@ public class RMIConnectorServer extends JMXConnectorServer {
* Creates a new RMIServerImpl.
**/
RMIServerImpl newServer() throws IOException {
- final boolean iiop = isIiopURL(address,true);
final int port;
if (address == null)
port = 0;
else
port = address.getPort();
- if (iiop)
- return newIIOPServer(attributes);
- else
- return newJRMPServer(attributes, port);
+
+ return newJRMPServer(attributes, port);
}
/**
@@ -675,10 +664,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
final int port;
if (address == null) {
- if (IIOPHelper.isStub(rmiServer))
- protocol = "iiop";
- else
- protocol = "rmi";
+ protocol = "rmi";
host = null; // will default to local host name
port = 0;
} else {
@@ -692,31 +678,12 @@ public class RMIConnectorServer extends JMXConnectorServer {
address = new JMXServiceURL(protocol, host, port, urlPath);
}
- static boolean isIiopURL(JMXServiceURL directoryURL, boolean strict)
- throws MalformedURLException {
- String protocol = directoryURL.getProtocol();
- if (protocol.equals("rmi"))
- return false;
- else if (protocol.equals("iiop"))
- return true;
- else if (strict) {
-
- throw new MalformedURLException("URL must have protocol " +
- "\"rmi\" or \"iiop\": \"" +
- protocol + "\"");
- }
- return false;
- }
-
/**
* Returns the IOR of the given rmiServer.
**/
static String encodeStub(
RMIServer rmiServer, Map env) throws IOException {
- if (IIOPHelper.isStub(rmiServer))
- return "/ior/" + encodeIIOPStub(rmiServer, env);
- else
- return "/stub/" + encodeJRMPStub(rmiServer, env);
+ return "/stub/" + encodeJRMPStub(rmiServer, env);
}
static String encodeJRMPStub(
@@ -730,17 +697,6 @@ public class RMIConnectorServer extends JMXConnectorServer {
return byteArrayToBase64(bytes);
}
- static String encodeIIOPStub(
- RMIServer rmiServer, Map env)
- throws IOException {
- try {
- Object orb = IIOPHelper.getOrb(rmiServer);
- return IIOPHelper.objectToString(orb, rmiServer);
- } catch (RuntimeException x) {
- throw newIOException(x.getMessage(), x);
- }
- }
-
/**
* Object that we will bind to the registry.
* This object is a stub connected to our RMIServerImpl.
@@ -748,8 +704,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
private static RMIServer objectToBind(
RMIServerImpl rmiServer, Map env)
throws IOException {
- return RMIConnector.
- connectStub((RMIServer)rmiServer.toStub(),env);
+ return (RMIServer)rmiServer.toStub();
}
private static RMIServerImpl newJRMPServer(Map env, int port)
@@ -761,11 +716,6 @@ public class RMIConnectorServer extends JMXConnectorServer {
return new RMIJRMPServerImpl(port, csf, ssf, env);
}
- private static RMIServerImpl newIIOPServer(Map env)
- throws IOException {
- return new RMIIIOPServerImpl(env);
- }
-
private static String byteArrayToBase64(byte[] a) {
int aLen = a.length;
int numFullGroups = aLen/3;
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java
index 45be553e1f7..00b25b71d9e 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -27,16 +27,9 @@ package javax.management.remote.rmi;
import java.io.IOException;
import java.rmi.Remote;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.Map;
-import java.util.Collections;
import javax.security.auth.Subject;
-import com.sun.jmx.remote.internal.IIOPHelper;
-
/**
*
An {@link RMIServerImpl} that is exported through IIOP and that
* creates client connections as RMI objects exported through IIOP.
@@ -45,120 +38,59 @@ import com.sun.jmx.remote.internal.IIOPHelper;
* @see RMIServerImpl
*
* @since 1.5
+ * @deprecated This transport is no longer supported.
*/
+@Deprecated
public class RMIIIOPServerImpl extends RMIServerImpl {
/**
- *
Creates a new {@link RMIServerImpl}.
+ * Throws {@linkplain UnsupportedOperationException}
*
* @param env the environment containing attributes for the new
* RMIServerImpl. Can be null, which is equivalent
* to an empty Map.
*
- * @exception IOException if the RMI object cannot be created.
+ * @throws IOException if the RMI object cannot be created.
*/
public RMIIIOPServerImpl(Map env)
throws IOException {
super(env);
- this.env = (env == null) ? Collections.emptyMap() : env;
-
- callerACC = AccessController.getContext();
+ throw new UnsupportedOperationException();
}
+ @Override
protected void export() throws IOException {
- IIOPHelper.exportObject(this);
+ throw new UnsupportedOperationException("Method not supported. JMX RMI-IIOP is deprecated");
}
+ @Override
protected String getProtocol() {
return "iiop";
}
- /**
- *
Returns an IIOP stub.
- * The stub might not yet be connected to the ORB. The stub will
- * be serializable only if it is connected to the ORB.
- * @return an IIOP stub.
- * @exception IOException if the stub cannot be created - e.g the
- * RMIIIOPServerImpl has not been exported yet.
- **/
+ @Override
public Remote toStub() throws IOException {
- // javax.rmi.CORBA.Stub stub =
- // (javax.rmi.CORBA.Stub) PortableRemoteObject.toStub(this);
- final Remote stub = IIOPHelper.toStub(this);
- // java.lang.System.out.println("NON CONNECTED STUB " + stub);
- // org.omg.CORBA.ORB orb =
- // org.omg.CORBA.ORB.init((String[])null, (Properties)null);
- // stub.connect(orb);
- // java.lang.System.out.println("CONNECTED STUB " + stub);
- return stub;
+ throw new UnsupportedOperationException();
}
- /**
- *
Creates a new client connection as an RMI object exported
- * through IIOP.
- *
- * @param connectionId the ID of the new connection. Every
- * connection opened by this connector server will have a
- * different ID. The behavior is unspecified if this parameter is
- * null.
- *
- * @param subject the authenticated subject. Can be null.
- *
- * @return the newly-created RMIConnection.
- *
- * @exception IOException if the new client object cannot be
- * created or exported.
- */
+ @Override
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);
- IIOPHelper.exportObject(client);
- return client;
+ throw new UnsupportedOperationException();
}
+ @Override
protected void closeClient(RMIConnection client) throws IOException {
- IIOPHelper.unexportObject(client);
+ throw new UnsupportedOperationException();
}
- /**
- *
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.
- */
+ @Override
protected void closeServer() throws IOException {
- IIOPHelper.unexportObject(this);
+ throw new UnsupportedOperationException();
}
@Override
RMIConnection doNewClient(final Object credentials) throws IOException {
- if (callerACC == null) {
- throw new SecurityException("AccessControlContext cannot be null");
- }
- try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public RMIConnection run() throws IOException {
- return superDoNewClient(credentials);
- }
- }, callerACC);
- } catch (PrivilegedActionException pae) {
- throw (IOException) pae.getCause();
- }
+ throw new UnsupportedOperationException();
}
-
- RMIConnection superDoNewClient(Object credentials) throws IOException {
- return super.doNewClient(credentials);
- }
-
- private final Map env;
- private final AccessControlContext callerACC;
}
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java
index 323f6bb2c2b..957a08e2535 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -61,8 +61,7 @@ import javax.security.auth.Subject;
* or by instantiating {@link RMIConnector}.
*
*
This is an abstract class. Concrete subclasses define the
- * details of the client connection objects, such as whether they use
- * JRMP or IIOP.
+ * details of the client connection objects.
*
* @since 1.5
*/
@@ -307,7 +306,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
/**
*
Returns the protocol string for this object. The string is
- * rmi for RMI/JRMP and iiop for RMI/IIOP.
+ * rmi for RMI/JRMP.
*
* @return the protocol string for this object.
*/
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html b/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html
index 09b09a3021e..9669be24397 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html
@@ -2,7 +2,7 @@