8043937: Drop support for the IIOP transport from the JMX RMIConnector
Reviewed-by: alanb, erikj
--- a/jdk/make/netbeans/jmx/build.xml Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/make/netbeans/jmx/build.xml Tue Mar 03 18:19:41 2015 +0100
@@ -63,8 +63,8 @@
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Call rmic-jmx subtargets -->
- <target name="-rmic-jmx" depends="-init,-rmic-jmx-jrmp,-rmic-jmx-iiop"
- description="Calls -init,-rmic-jmx-jrmp,-rmic-jmx-iiop"
+ <target name="-rmic-jmx" depends="-init,-rmic-jmx-jrmp"
+ description="Calls -init,-rmic-jmx-jrmp"
/>
@@ -90,44 +90,6 @@
</target>
-
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <!-- Generate RMI IIOP stub class files for remote objects -->
-
- <target name="-rmic-jmx-iiop" depends="-init,-check-jmx-iiop-uptodate" unless="jmx-iiop-uptodate"
- description="Generate RMI IIOP stub class files for remote objects. Do not keep generated java files." >
-
- <rmic base="${classes.dir}"
- includeAntRuntime="no"
- includeJavaRuntime="no"
- stubversion="1.2"
- iiop="yes"
- >
- <include name="javax/management/remote/rmi/RMIConnectionImpl.class" />
- <include name="javax/management/remote/rmi/RMIServerImpl.class" />
- </rmic>
-
- </target>
-
-
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <!-- Check if jmx rmic generated IIOP stub and tie class files are up to date -->
-
- <target name="-check-jmx-iiop-uptodate" depends="-init">
-
- <uptodate property="jmx-iiop-uptodate"
- srcfile="${classes.dir}/javax/management/remote/rmi/RMIConnectionImpl.class"
- targetfile="${classes.dir}/org/omg/stub/javax/management/remote/rmi/_RMIConnectionImpl_Tie.class"
- />
- <uptodate property="jmx-iiop-uptodate"
- srcfile="${classes.dir}/javax/management/remote/rmi/RMIServerImpl.class"
- targetfile="${classes.dir}/org/omg/stub/javax/management/remote/rmi/_RMIServerImpl_Tie.class"
- />
-
- <echo message="jmx-iiop-uptodate=${jmx-iiop-uptodate}" />
-
- </target>
-
<target name="-post-compile" depends="-init,-rmic-jmx"
description="Jar JMX class files (including RMI stubs)" >
<mkdir dir="${dist.dir}/lib"/>
--- a/jdk/make/rmic/Rmic-java.management.gmk Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/make/rmic/Rmic-java.management.gmk Tue Mar 03 18:19:41 2015 +0100
@@ -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 @@
# 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, \
+
+# 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 := $(STUB_CLASSES_DIR)/java.management, \
+ STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR), \
RUN_V12 := true, \
- RUN_IIOP := $(GENRMIIIOPCLASSES), \
- RUN_IIOP_STDPKG := $(GENRMIIIOPCLASSES)))
+ KEEP_GENERATED := true, \
+))
-# 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, \
- CLASSES := $(JMX_RMI_CLASSES), \
- CLASSES_DIR := $(CLASSES_DIR)/java.management, \
- STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR)/java.management, \
- RUN_V12 := 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
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java Thu Aug 20 07:36:37 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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<IIOPProxy>() {
- 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> T narrow(Object narrowFrom, Class<T> 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);
- }
-}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java Thu Aug 20 07:36:37 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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> T narrow(Object narrowFrom, Class<T> 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;
-}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java Thu Aug 20 07:36:37 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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<String,?> environment)
- throws IOException {
- if (!serviceURL.getProtocol().equals("iiop")) {
- throw new MalformedURLException("Protocol not iiop: " +
- serviceURL.getProtocol());
- }
- return new RMIConnector(serviceURL, environment);
- }
-}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java Thu Aug 20 07:36:37 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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> T narrow(Object narrowFrom, Class<T> 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<Remote>() {
-
- @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());
- }
- }
- }
-}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java Thu Aug 20 07:36:37 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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;
-}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java Thu Aug 20 07:36:37 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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<String,?> environment,
- MBeanServer mbeanServer)
- throws IOException {
- if (!serviceURL.getProtocol().equals("iiop")) {
- throw new MalformedURLException("Protocol not iiop: " +
- serviceURL.getProtocol());
- }
- return new RMIConnectorServer(serviceURL, environment, mbeanServer);
- }
-
-}
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Tue Mar 03 18:19:41 2015 +0100
@@ -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 @@
*
* <p>Every implementation must support the RMI connector protocol with
* the default RMI transport, specified with string <code>rmi</code>.
- * An implementation may optionally support the RMI connector protocol
- * with the RMI/IIOP transport, specified with the string
- * <code>iiop</code>.</p>
+ * </p>
*
* <p>Once a provider is found, the result of the
* <code>newJMXConnector</code> method is the result of calling {@link
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java Tue Mar 03 18:19:41 2015 +0100
@@ -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 @@
*
* <p>Every implementation must support the RMI connector protocol with
* the default RMI transport, specified with string <code>rmi</code>.
- * An implementation may optionally support the RMI connector protocol
- * with the RMI/IIOP transport, specified with the string
- * <code>iiop</code>.</p>
+ * </p>
*
* <p>Once a provider is found, the result of the
* <code>newJMXConnectorServer</code> method is the result of calling
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java Tue Mar 03 18:19:41 2015 +0100
@@ -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 @@
<p>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
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java Tue Mar 03 18:19:41 2015 +0100
@@ -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 @@
/**
* 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
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java Tue Mar 03 18:19:41 2015 +0100
@@ -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.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.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 @@
* the RMI connector server with the given address.</p>
*
* <p>The address can refer directly to the connector server,
- * using one of the following syntaxes:</p>
+ * using the following syntax:</p>
*
* <pre>
* service:jmx:rmi://<em>[host[:port]]</em>/stub/<em>encoded-stub</em>
- * service:jmx:iiop://<em>[host[:port]]</em>/ior/<em>encoded-IOR</em>
* </pre>
*
* <p>(Here, the square brackets {@code []} are not part of the
* address but indicate that the host and port are optional.)</p>
*
* <p>The address can instead indicate where to find an RMI stub
- * through JNDI, using one of the following syntaxes:</p>
+ * through JNDI, using the following syntax:</p>
*
* <pre>
* service:jmx:rmi://<em>[host[:port]]</em>/jndi/<em>jndi-name</em>
- * service:jmx:iiop://<em>[host[:port]]</em>/jndi/<em>jndi-name</em>
* </pre>
*
* <p>An implementation may also recognize additional address
@@ -242,8 +235,7 @@
/**
* @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 @@
/**
* @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<String,?> environment)
throws IOException {
@@ -294,9 +285,7 @@
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 @@
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 @@
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 @@
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);
@@ -1694,103 +1661,6 @@
// Private stuff - Serialization
//--------------------------------------------------------------------
/**
- * <p>In order to be usable, an IIOP stub must be connected to an ORB.
- * The stub is automatically connected to the ORB if:
- * <ul>
- * <li> It was returned by the COS naming</li>
- * <li> Its server counterpart has been registered in COS naming
- * through JNDI.</li>
- * </ul>
- * 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.<br>
- * 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.
- * <p>
- * In order to palliate this, this method will connect the
- * given stub if it is not yet connected. If the given
- * <var>RMIServer</var> 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:
- * <ul>
- * <li>This method looks in the provided <var>environment</var> 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)}</li>
- * <li>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 <var>environment</var> map, if any.</li>
- * </ul>
- * @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<String, ?> 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 <var>environment</var>, or create a
- * new one.
- * <p>This method looks in the provided <var>environment</var> 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)}
- * <p>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 <var>environment</var> 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<String, ?> 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<Object>(newOrb);
- return newOrb;
- }
-
- /**
* Read RMIConnector fields from an {@link java.io.ObjectInputStream
* ObjectInputStream}.
* Calls {@code s.defaultReadObject()} and then initializes
@@ -1846,7 +1716,6 @@
throws IOException {
if (rmiServer == null && jmxServiceURL == null) throw new
InvalidObjectException("rmiServer and jmxServiceURL both null.");
- connectStub(this.rmiServer,env);
s.defaultWriteObject();
}
@@ -1911,24 +1780,15 @@
private RMIServer findRMIServer(JMXServiceURL directoryURL,
Map<String, Object> environment)
throws NamingException, IOException {
- final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
- if (isIiop) {
- // Make sure java.naming.corba.orb is in the Map.
- environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
- }
String path = directoryURL.getURLPath();
int end = path.indexOf(';');
if (end < 0) end = path.length();
if (path.startsWith("/jndi/"))
- return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
+ return findRMIServerJNDI(path.substring(6,end), environment);
else if (path.startsWith("/stub/"))
- return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
- else if (path.startsWith("/ior/")) {
- if (!IIOPHelper.isAvailable())
- throw new IOException("iiop protocol not available");
- return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
- } else {
+ return findRMIServerJRMP(path.substring(6,end), environment);
+ else {
final String msg = "URL path must begin with /jndi/ or /stub/ " +
"or /ior/: " + path;
throw new MalformedURLException(msg);
@@ -1940,16 +1800,13 @@
* @param jndiURL A JNDI URL indicating the location of the Stub
* (see {@link javax.management.remote.rmi}), e.g.:
* <ul><li>{@code rmi://registry-host:port/rmi-stub-name}</li>
- * <li>or {@code iiop://cosnaming-host:port/iiop-stub-name}</li>
* <li>or {@code ldap://ldap-host:port/java-container-dn}</li>
* </ul>
* @param env the environment Map passed to the connector.
- * @param isIiop true if the stub is expected to be an IIOP stub.
* @return The retrieved RMIServer stub.
* @exception NamingException if the stub couldn't be found.
**/
- private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
- boolean isIiop)
+ private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env)
throws NamingException {
InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));
@@ -1957,10 +1814,7 @@
Object objref = ctx.lookup(jndiURL);
ctx.close();
- if (isIiop)
- return narrowIIOPServer(objref);
- else
- return narrowJRMPServer(objref);
+ return narrowJRMPServer(objref);
}
private static RMIServer narrowJRMPServer(Object objref) {
@@ -1968,28 +1822,8 @@
return (RMIServer) objref;
}
- private static RMIServer narrowIIOPServer(Object objref) {
- try {
- return IIOPHelper.narrow(objref, RMIServer.class);
- } catch (ClassCastException e) {
- if (logger.traceOn())
- logger.trace("narrowIIOPServer","Failed to narrow objref=" +
- objref + ": " + e);
- if (logger.debugOn()) logger.debug("narrowIIOPServer",e);
- return null;
- }
- }
-
- private RMIServer findRMIServerIIOP(String ior, Map<String, ?> env, boolean isIiop) {
- // could forbid "rmi:" URL here -- but do we need to?
- final Object orb = env.get(EnvHelp.DEFAULT_ORB);
- final Object stub = IIOPHelper.stringToObject(orb, ior);
- return IIOPHelper.narrow(stub, RMIServer.class);
- }
-
- private RMIServer findRMIServerJRMP(String base64, Map<String, ?> env, boolean isIiop)
+ private RMIServer findRMIServerJRMP(String base64, Map<String, ?> env)
throws IOException {
- // could forbid "iiop:" URL here -- but do we need to?
final byte[] serialized;
try {
serialized = base64ToByteArray(base64);
@@ -2203,228 +2037,6 @@
return proxyStub;
}
- /*
- The following code performs a similar trick for RMI/IIOP to the
- one described above for RMI/JRMP. Unlike JRMP, though, we
- can't easily insert an object between the RMIConnection stub
- and the RMI/IIOP deserialization code, as explained below.
-
- A method in an RMI/IIOP stub does the following. It makes an
- org.omg.CORBA_2_3.portable.OutputStream for each request, and
- writes the parameters to it. Then it calls
- _invoke(OutputStream) which it inherits from CORBA's
- ObjectImpl. That returns an
- org.omg.CORBA_2_3.portable.InputStream. The return value is
- read from this InputStream. So the stack during
- deserialization looks like this:
-
- MBeanServerConnection.getAttribute (or whatever)
- -> _RMIConnection_Stub.getAttribute
- -> Util.readAny (a CORBA method)
- -> InputStream.read_any
- -> internal CORBA stuff
-
- What we would have *liked* to have done would be the same thing
- as for RMI/JRMP. We create a "ProxyDelegate" that is an
- org.omg.CORBA.portable.Delegate that simply forwards every
- operation to the real original Delegate from the RMIConnection
- stub, except that the InputStream returned by _invoke is
- wrapped by a "ProxyInputStream" that is loaded by our
- NoCallStackClassLoader.
-
- Unfortunately, this doesn't work, at least with Sun's J2SE
- 1.4.2, because the CORBA code is not designed to allow you to
- change Delegates arbitrarily. You get a ClassCastException
- from code that expects the Delegate to implement an internal
- interface.
-
- So instead we do the following. We create a subclass of the
- stub that overrides the _invoke method so as to wrap the
- returned InputStream in a ProxyInputStream. We create a
- subclass of ProxyInputStream using the NoCallStackClassLoader
- and override its read_any and read_value(Class) methods.
- (These are the only methods called during deserialization of
- MBeanServerConnection return values.) We extract the Delegate
- from the original stub and insert it into our subclass stub,
- and away we go. The state of a stub consists solely of its
- Delegate.
-
- We also need to catch ApplicationException, which will encode
- any exceptions declared in the throws clause of the called
- method. Its InputStream needs to be wrapped in a
- ProxyInputSteam too.
-
- We override _releaseReply in the stub subclass so that it
- replaces a ProxyInputStream argument with the original
- InputStream. This avoids problems if the implementation of
- _releaseReply ends up casting this InputStream to an
- implementation-specific interface (which in Sun's J2SE 5 it
- does).
-
- It is not strictly necessary for the stub subclass to be loaded
- by a NoCallStackClassLoader, since the call-stack search stops
- at the ProxyInputStream subclass. However, it is convenient
- for two reasons. One is that it means that the
- ProxyInputStream subclass can be accessed directly, without
- using reflection. The other is that it avoids build problems,
- since usually stubs are created after other classes are
- compiled, so we can't access them from this class without,
- again, using reflection.
-
- The strings below encode the following two Java classes,
- compiled using javac -g:none.
-
- package com.sun.jmx.remote.protocol.iiop;
-
- import org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub;
-
- import org.omg.CORBA.portable.ApplicationException;
- import org.omg.CORBA.portable.InputStream;
- import org.omg.CORBA.portable.OutputStream;
- import org.omg.CORBA.portable.RemarshalException;
-
- public class ProxyStub extends _RMIConnection_Stub {
- public InputStream _invoke(OutputStream out)
- throws ApplicationException, RemarshalException {
- try {
- return new PInputStream(super._invoke(out));
- } catch (ApplicationException e) {
- InputStream pis = new PInputStream(e.getInputStream());
- throw new ApplicationException(e.getId(), pis);
- }
- }
-
- public void _releaseReply(InputStream in) {
- if (in != null)
- in = ((PInputStream)in).getProxiedInputStream();
- super._releaseReply(in);
- }
- }
-
- package com.sun.jmx.remote.protocol.iiop;
-
- public class PInputStream extends ProxyInputStream {
- public PInputStream(org.omg.CORBA.portable.InputStream in) {
- super(in);
- }
-
- public org.omg.CORBA.Any read_any() {
- return in.read_any();
- }
-
- public java.io.Serializable read_value(Class clz) {
- return narrow().read_value(clz);
- }
- }
-
-
- */
- private static final String iiopConnectionStubClassName =
- "org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub";
- private static final String proxyStubClassName =
- "com.sun.jmx.remote.protocol.iiop.ProxyStub";
- private static final String ProxyInputStreamClassName =
- "com.sun.jmx.remote.protocol.iiop.ProxyInputStream";
- private static final String pInputStreamClassName =
- "com.sun.jmx.remote.protocol.iiop.PInputStream";
- private static final Class<?> proxyStubClass;
- static {
- final String proxyStubByteCodeString =
- "\312\376\272\276\0\0\0\63\0+\12\0\14\0\30\7\0\31\12\0\14\0\32\12"+
- "\0\2\0\33\7\0\34\12\0\5\0\35\12\0\5\0\36\12\0\5\0\37\12\0\2\0 "+
- "\12\0\14\0!\7\0\"\7\0#\1\0\6<init>\1\0\3()V\1\0\4Code\1\0\7_in"+
- "voke\1\0K(Lorg/omg/CORBA/portable/OutputStream;)Lorg/omg/CORBA"+
- "/portable/InputStream;\1\0\15StackMapTable\7\0\34\1\0\12Except"+
- "ions\7\0$\1\0\15_releaseReply\1\0'(Lorg/omg/CORBA/portable/Inp"+
- "utStream;)V\14\0\15\0\16\1\0-com/sun/jmx/remote/protocol/iiop/"+
- "PInputStream\14\0\20\0\21\14\0\15\0\27\1\0+org/omg/CORBA/porta"+
- "ble/ApplicationException\14\0%\0&\14\0'\0(\14\0\15\0)\14\0*\0&"+
- "\14\0\26\0\27\1\0*com/sun/jmx/remote/protocol/iiop/ProxyStub\1"+
- "\0<org/omg/stub/javax/management/remote/rmi/_RMIConnection_Stu"+
- "b\1\0)org/omg/CORBA/portable/RemarshalException\1\0\16getInput"+
- "Stream\1\0&()Lorg/omg/CORBA/portable/InputStream;\1\0\5getId\1"+
- "\0\24()Ljava/lang/String;\1\09(Ljava/lang/String;Lorg/omg/CORB"+
- "A/portable/InputStream;)V\1\0\25getProxiedInputStream\0!\0\13\0"+
- "\14\0\0\0\0\0\3\0\1\0\15\0\16\0\1\0\17\0\0\0\21\0\1\0\1\0\0\0\5"+
- "*\267\0\1\261\0\0\0\0\0\1\0\20\0\21\0\2\0\17\0\0\0G\0\4\0\4\0\0"+
- "\0'\273\0\2Y*+\267\0\3\267\0\4\260M\273\0\2Y,\266\0\6\267\0\4N"+
- "\273\0\5Y,\266\0\7-\267\0\10\277\0\1\0\0\0\14\0\15\0\5\0\1\0\22"+
- "\0\0\0\6\0\1M\7\0\23\0\24\0\0\0\6\0\2\0\5\0\25\0\1\0\26\0\27\0"+
- "\1\0\17\0\0\0'\0\2\0\2\0\0\0\22+\306\0\13+\300\0\2\266\0\11L*+"+
- "\267\0\12\261\0\0\0\1\0\22\0\0\0\3\0\1\14\0\0";
- final String pInputStreamByteCodeString =
- "\312\376\272\276\0\0\0\63\0\36\12\0\7\0\17\11\0\6\0\20\12\0\21"+
- "\0\22\12\0\6\0\23\12\0\24\0\25\7\0\26\7\0\27\1\0\6<init>\1\0'("+
- "Lorg/omg/CORBA/portable/InputStream;)V\1\0\4Code\1\0\10read_an"+
- "y\1\0\25()Lorg/omg/CORBA/Any;\1\0\12read_value\1\0)(Ljava/lang"+
- "/Class;)Ljava/io/Serializable;\14\0\10\0\11\14\0\30\0\31\7\0\32"+
- "\14\0\13\0\14\14\0\33\0\34\7\0\35\14\0\15\0\16\1\0-com/sun/jmx"+
- "/remote/protocol/iiop/PInputStream\1\0\61com/sun/jmx/remote/pr"+
- "otocol/iiop/ProxyInputStream\1\0\2in\1\0$Lorg/omg/CORBA/portab"+
- "le/InputStream;\1\0\"org/omg/CORBA/portable/InputStream\1\0\6n"+
- "arrow\1\0*()Lorg/omg/CORBA_2_3/portable/InputStream;\1\0&org/o"+
- "mg/CORBA_2_3/portable/InputStream\0!\0\6\0\7\0\0\0\0\0\3\0\1\0"+
- "\10\0\11\0\1\0\12\0\0\0\22\0\2\0\2\0\0\0\6*+\267\0\1\261\0\0\0"+
- "\0\0\1\0\13\0\14\0\1\0\12\0\0\0\24\0\1\0\1\0\0\0\10*\264\0\2\266"+
- "\0\3\260\0\0\0\0\0\1\0\15\0\16\0\1\0\12\0\0\0\25\0\2\0\2\0\0\0"+
- "\11*\266\0\4+\266\0\5\260\0\0\0\0\0\0";
- final byte[] proxyStubByteCode =
- NoCallStackClassLoader.stringToBytes(proxyStubByteCodeString);
- final byte[] pInputStreamByteCode =
- NoCallStackClassLoader.stringToBytes(pInputStreamByteCodeString);
- final String[] classNames={proxyStubClassName, pInputStreamClassName};
- final byte[][] byteCodes = {proxyStubByteCode, pInputStreamByteCode};
- final String[] otherClassNames = {
- iiopConnectionStubClassName,
- ProxyInputStreamClassName,
- };
- if (IIOPHelper.isAvailable()) {
- PrivilegedExceptionAction<Class<?>> action =
- new PrivilegedExceptionAction<Class<?>>() {
- public Class<?> run() throws Exception {
- Class<RMIConnector> thisClass = RMIConnector.class;
- ClassLoader thisLoader = thisClass.getClassLoader();
- ProtectionDomain thisProtectionDomain =
- thisClass.getProtectionDomain();
- ClassLoader cl =
- new NoCallStackClassLoader(classNames,
- byteCodes,
- otherClassNames,
- thisLoader,
- thisProtectionDomain);
- return cl.loadClass(proxyStubClassName);
- }
- };
- Class<?> stubClass;
- try {
- stubClass = AccessController.doPrivileged(action);
- } catch (Exception e) {
- logger.error("<clinit>",
- "Unexpected exception making shadow IIOP stub class: "+e);
- logger.debug("<clinit>",e);
- stubClass = null;
- }
- proxyStubClass = stubClass;
- } else {
- proxyStubClass = null;
- }
- }
-
- private static RMIConnection shadowIiopStub(Object stub)
- throws InstantiationException, IllegalAccessException {
- Object proxyStub = null;
- try {
- proxyStub = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- return proxyStubClass.newInstance();
- }
- });
- } catch (PrivilegedActionException e) {
- throw new InternalError();
- }
- IIOPHelper.setDelegate(proxyStub, IIOPHelper.getDelegate(stub));
- return (RMIConnection) proxyStub;
- }
private static RMIConnection getConnection(RMIServer server,
Object credentials,
boolean checkStub)
@@ -2434,8 +2046,6 @@
try {
if (c.getClass() == rmiConnectionImplStubClass)
return shadowJrmpStub((RemoteObject) c);
- if (c.getClass().getName().equals(iiopConnectionStubClassName))
- return shadowIiopStub(c);
logger.trace("getConnection",
"Did not wrap " + c.getClass() + " to foil " +
"stack search for classes: class loading semantics " +
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectorServer.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectorServer.java Tue Mar 03 18:19:41 2015 +0100
@@ -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
@@ -27,7 +27,6 @@
import com.sun.jmx.remote.security.MBeanServerFileAccessController;
-import com.sun.jmx.remote.internal.IIOPHelper;
import com.sun.jmx.remote.util.ClassLogger;
import com.sun.jmx.remote.util.EnvHelp;
@@ -117,8 +116,8 @@
*
* @exception MalformedURLException if <code>url</code> does not
* conform to the syntax for an RMI connector, or if its protocol
- * is not recognized by this implementation. Only "rmi" and "iiop"
- * are valid when this constructor is used.
+ * is not recognized by this implementation. Only "rmi" is valid when
+ * this constructor is used.
*
* @exception IOException if the connector server cannot be created
* for some reason or if it is inevitable that its {@link #start()
@@ -151,8 +150,8 @@
*
* @exception MalformedURLException if <code>url</code> does not
* conform to the syntax for an RMI connector, or if its protocol
- * is not recognized by this implementation. Only "rmi" and "iiop"
- * are valid when this constructor is used.
+ * is not recognized by this implementation. Only "rmi" is valid
+ * when this constructor is used.
*
* @exception IOException if the connector server cannot be created
* for some reason or if it is inevitable that its {@link #start()
@@ -179,7 +178,7 @@
* consistent with the protocol type specified in <var>url</var>.
* If this parameter is non null, the protocol type specified by
* <var>url</var> is not constrained, and is assumed to be valid.
- * Otherwise, only "rmi" and "iiop" will be recognized.
+ * Otherwise, only "rmi" will be recognized.
*
* @param mbeanServer the MBean server to which the new connector
* server is attached, or null if it will be attached by being
@@ -189,8 +188,8 @@
*
* @exception MalformedURLException if <code>url</code> does not
* conform to the syntax for an RMI connector, or if its protocol
- * is not recognized by this implementation. Only "rmi" and "iiop"
- * are recognized when <var>rmiServerImpl</var> is null.
+ * is not recognized by this implementation. Only "rmi" is recognized
+ * when <var>rmiServerImpl</var> is null.
*
* @exception IOException if the connector server cannot be created
* for some reason or if it is inevitable that its {@link #start()
@@ -208,7 +207,7 @@
IllegalArgumentException("Null JMXServiceURL");
if (rmiServerImpl == null) {
final String prt = url.getProtocol();
- if (prt == null || !(prt.equals("rmi") || prt.equals("iiop"))) {
+ if (prt == null || !(prt.equals("rmi"))) {
final String msg = "Invalid protocol type: " + prt;
throw new MalformedURLException(msg);
}
@@ -298,11 +297,6 @@
* <li>If an <code>RMIServerImpl</code> was supplied to the
* constructor, it is used.
*
- * <li>Otherwise, if the protocol part of the
- * <code>JMXServiceURL</code> supplied to the constructor was
- * <code>iiop</code>, an object of type {@link RMIIIOPServerImpl}
- * is created.
- *
* <li>Otherwise, if the <code>JMXServiceURL</code>
* was null, or its protocol part was <code>rmi</code>, an object
* of type {@link RMIJRMPServerImpl} is created.
@@ -324,21 +318,19 @@
* will not be bound to a directory. Instead, a reference to it
* will be encoded in the URL path of the RMIConnectorServer
* address (returned by {@link #getAddress()}). The encodings for
- * <code>rmi</code> and <code>iiop</code> are described in the
- * package documentation for {@link
- * javax.management.remote.rmi}.</p>
+ * <code>rmi</code> are described in the package documentation for
+ * {@link javax.management.remote.rmi}.</p>
*
* <p>The behavior when the URL path is neither empty nor a JNDI
- * directory URL, or when the protocol is neither <code>rmi</code>
- * nor <code>iiop</code>, is implementation defined, and may
- * include throwing {@link MalformedURLException} when the
- * connector server is created or when it is started.</p>
+ * directory URL, or when the protocol is not <code>rmi</code>,
+ * is implementation defined, and may include throwing
+ * {@link MalformedURLException} when the connector server is created
+ * or when it is started.</p>
*
* @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 @@
* 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 @@
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 @@
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<String, ?> 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 @@
return byteArrayToBase64(bytes);
}
- static String encodeIIOPStub(
- RMIServer rmiServer, Map<String, ?> 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 @@
private static RMIServer objectToBind(
RMIServerImpl rmiServer, Map<String, ?> env)
throws IOException {
- return RMIConnector.
- connectStub((RMIServer)rmiServer.toStub(),env);
+ return (RMIServer)rmiServer.toStub();
}
private static RMIServerImpl newJRMPServer(Map<String, ?> env, int port)
@@ -761,11 +716,6 @@
return new RMIJRMPServerImpl(port, csf, ssf, env);
}
- private static RMIServerImpl newIIOPServer(Map<String, ?> env)
- throws IOException {
- return new RMIIIOPServerImpl(env);
- }
-
private static String byteArrayToBase64(byte[] a) {
int aLen = a.length;
int numFullGroups = aLen/3;
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java Tue Mar 03 18:19:41 2015 +0100
@@ -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 @@
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;
-
/**
* <p>An {@link RMIServerImpl} that is exported through IIOP and that
* creates client connections as RMI objects exported through IIOP.
@@ -45,120 +38,59 @@
* @see RMIServerImpl
*
* @since 1.5
+ * @deprecated This transport is no longer supported.
*/
+@Deprecated
public class RMIIIOPServerImpl extends RMIServerImpl {
/**
- * <p>Creates a new {@link RMIServerImpl}.</p>
+ * Throws {@linkplain UnsupportedOperationException}
*
* @param env the environment containing attributes for the new
* <code>RMIServerImpl</code>. 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<String,?> env)
throws IOException {
super(env);
- this.env = (env == null) ? Collections.<String, Object>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";
}
- /**
- * <p>Returns an IIOP stub.</p>
- * 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();
}
- /**
- * <p>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 <code>RMIConnection</code>.
- *
- * @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();
}
- /**
- * <p>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.</p>
- *
- * @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<RMIConnection>() {
- 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<String, ?> env;
- private final AccessControlContext callerACC;
}
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java Tue Mar 03 18:19:41 2015 +0100
@@ -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 @@
* or by instantiating {@link RMIConnector}.</p>
*
* <p>This is an abstract class. Concrete subclasses define the
- * details of the client connection objects, such as whether they use
- * JRMP or IIOP.</p>
+ * details of the client connection objects.</p>
*
* @since 1.5
*/
@@ -307,7 +306,7 @@
/**
* <p>Returns the protocol string for this object. The string is
- * <code>rmi</code> for RMI/JRMP and <code>iiop</code> for RMI/IIOP.
+ * <code>rmi</code> for RMI/JRMP.
*
* @return the protocol string for this object.
*/
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html Tue Mar 03 18:19:41 2015 +0100
@@ -2,7 +2,7 @@
<head>
<title>RMI connector</title>
<!--
-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
@@ -36,16 +36,14 @@
that different implementations of the RMI connector can
interoperate.</p>
- <p>The RMI connector supports the JRMP transport for RMI, and
- optionally the IIOP transport.</p>
+ <p>The RMI connector supports the JRMP transport for RMI.</p>
<p>Like most connectors in the JMX Remote API, an RMI connector
usually has an address, which
is a {@link javax.management.remote.JMXServiceURL
JMXServiceURL}. The protocol part of this address is
<code>rmi</code> for a connector that uses the default RMI
- transport (JRMP), or <code>iiop</code> for a connector that
- uses RMI/IIOP.</p>
+ transport (JRMP).</p>
<p>There are two forms for RMI connector addresses:</p>
@@ -65,10 +63,9 @@
information needed to connect to the connector server. When
using RMI/JRMP, the encoded form is the serialized RMI stub
for the server object, encoded using BASE64 without embedded
- newlines. When using RMI/IIOP, the encoded form is the CORBA
- IOR for the server object.
+ newlines.
</ul>
-
+
<p>Addresses are covered in more detail below.</p>
@@ -91,9 +88,8 @@
<h4>Choosing the RMI transport</h4>
- <p>You can choose the RMI transport (JRMP or IIOP) by specifying
- <code>rmi</code> or <code>iiop</code> in the
- <code><em>protocol</em></code> part of the
+ <p>You can choose the RMI transport by specifying
+ <code>rmi</code> in the <code><em>protocol</em></code> part of the
<code>serviceURL</code> when creating the connector server. You
can also create specialized connector servers by instantiating
an appropriate subclass of {@link
@@ -132,33 +128,9 @@
stub for the generated object, encoded in BASE64 without
newlines.</p>
- <li><p>If the <code>serviceURL</code> looks like:</p>
-
- <pre>
- <code>service:jmx:iiop://<em>host</em>:<em>port</em></code>
- </pre>
-
- <p>then the connector server will generate an {@link
- javax.management.remote.rmi.RMIIIOPServerImpl
- RMIIIOPServerImpl} and the returned
- <code>JMXServiceURL</code> looks like:</p>
-
- <pre>
- <code>service:jmx:iiop://<em>host</em>:<em>port</em>/ior/IOR:<em>XXXX</em></code>
- </pre>
-
- <p>where <code>IOR:<em>XXXX</em></code> is the standard CORBA
- encoding of the Interoperable Object Reference for the
- generated object.</p>
-
<li><p>If there is no <code>serviceURL</code>, there must be a
- user-provided <code>RMIServerImpl</code>. If the {@link
- javax.management.remote.rmi.RMIServerImpl#toStub toStub}
- method on this object returns an instance of {@link
- javax.rmi.CORBA.Stub}, then the connector server will generate
- a <code>JMXServiceURL</code> using the <code>iiop</code>
- form above. Otherwise, it will generate a
- <code>JMXServiceURL</code> using the <code>rmi</code>
+ user-provided <code>RMIServerImpl</code>. The connector server
+ will generate a <code>JMXServiceURL</code> using the <code>rmi</code>
form.</p>
</ul>
@@ -195,12 +167,10 @@
stub. This directory address is then used by both client and
server.</p>
- <p>In this case, the <code>serviceURL</code> has one of these two
- forms:</p>
+ <p>In this case, the <code>serviceURL</code> has the following form:</p>
<pre>
<code>service:jmx:rmi://<em>host</em>:<em>port</em>/jndi/<em>jndi-name</em></code>
- <code>service:jmx:iiop://<em>host</em>:<em>port</em>/jndi/<em>jndi-name</em></code>
</pre>
<p>Here, <code><em>jndi-name</em></code> is a string that can be
@@ -212,8 +182,7 @@
<p>The connector server will generate an
<code>RMIServerImpl</code> based on the protocol
- (<code>rmi</code> or <code>iiop</code>) and, for
- <code>rmi</code>, the <code><em>port</em></code> if any. When
+ (<code>rmi</code>) and the <code><em>port</em></code> if any. When
the connector server is started, it will derive a stub from this
object using its {@link
javax.management.remote.rmi.RMIServerImpl#toStub toStub} method
@@ -250,11 +219,11 @@
<p>As another example, if the <code>JMXServiceURL</code> is:
<pre>
- <code>service:jmx:iiop://ignoredhost/jndi/ldap://dirhost:9999/cn=this,ou=that</code>
+ <code>service:jmx:rmi://ignoredhost/jndi/ldap://dirhost:9999/cn=this,ou=that</code>
</pre>
then the connector server will generate an
- <code>RMIIIOPServerImpl</code> and store its stub using the JNDI
+ <code>RMIJRMPServerImpl</code> and store its stub using the JNDI
name
<pre>
@@ -267,11 +236,11 @@
<p>If the <code>JMXServiceURL</code> is:
<pre>
- <code>service:jmx:iiop://ignoredhost/jndi/cn=this,ou=that</code>
+ <code>service:jmx:rmi://ignoredhost/jndi/cn=this,ou=that</code>
</pre>
then the connector server will generate an
- <code>RMIIIOPServerImpl</code> and store its stub using the JNDI
+ <code>RMIJRMPServerImpl</code> and store its stub using the JNDI
name
<pre>
@@ -287,7 +256,7 @@
omitted, for example:</p>
<pre>
- <code>service:jmx:iiop:///jndi/cn=this,ou=that</code>
+ <code>service:jmx:rmi:///jndi/cn=this,ou=that</code>
</pre>
<p>However, it is good practice to use the name of the host
@@ -313,8 +282,7 @@
<p>An RMI connector client is usually constructed using {@link
javax.management.remote.JMXConnectorFactory}, with a
- <code>JMXServiceURL</code> that has <code>rmi</code> or
- <code>iiop</code> as its protocol.</p>
+ <code>JMXServiceURL</code> that has <code>rmi</code> as its protocol.</p>
<p>If the <code>JMXServiceURL</code> was generated by the server,
as described above under <a href="#servergen">"connector
@@ -343,37 +311,6 @@
constructor of {@link javax.management.remote.rmi.RMIConnector
RMIConnector}.</p>
-
- <h3>Specifying an ORB for the RMI/IIOP connector</h3>
-
- <p>When using the IIOP transport, the client and server can
- specify what ORB to use
- with the attribute <code>java.naming.corba.orb</code>.
- Connection to the ORB happens at {@link
- javax.management.remote.rmi.RMIConnectorServer#start() start} time
- for the connector server, and at {@link
- javax.management.remote.rmi.RMIConnector#connect(java.util.Map)
- connect} time for the connector client.
- If the <code>java.naming.corba.orb</code> attribute is contained
- in the environment Map, then its value (an {@link
- org.omg.CORBA.ORB ORB}), is used to connect the IIOP Stubs.
- Otherwise, a new org.omg.CORBA.ORB is created by calling {@link
- org.omg.CORBA.ORB
- org.omg.CORBA.ORB.init((String[])null,(Properties)null)}. A
- later RMI connector client or server in the same JVM can reuse
- this ORB, or it can create another one in the same way.</p>
-
- <p>If the <code>java.naming.corba.orb</code> attribute is
- specified and does not point to an {@link org.omg.CORBA.ORB ORB},
- then an <code>{@link java.lang.IllegalArgumentException}</code>
- will be thrown.</p>
-
- <p>The mechanism described here does not apply when the IIOP
- Remote objects (Stubs or Servers) are created and connected to
- an ORB manually before being passed to the RMIConnector and
- RMIConnectorServer.</p>
-
-
<h3>Dynamic code downloading</h3>
<p>If an RMI connector client or server receives from its peer an
@@ -385,7 +322,7 @@
code downloading using Java RMI</em></a> explains this in more
detail.</p>
-
+
@see <a href="{@docRoot}/../technotes/guides/rmi/index.html">
Java™ Remote Method
Invocation (RMI)</a>
--- a/jdk/test/javax/management/remote/mandatory/connection/CloseableTest.java Thu Aug 20 07:36:37 2015 -0700
+++ b/jdk/test/javax/management/remote/mandatory/connection/CloseableTest.java Tue Mar 03 18:19:41 2015 +0100
@@ -40,7 +40,6 @@
import javax.management.remote.rmi.RMIConnectionImpl;
import javax.management.remote.rmi.RMIConnectionImpl_Stub;
import javax.management.remote.rmi.RMIConnector;
-import javax.management.remote.rmi.RMIIIOPServerImpl;
import javax.management.remote.rmi.RMIJRMPServerImpl;
import javax.management.remote.rmi.RMIServerImpl;
@@ -52,7 +51,6 @@
RMIConnectionImpl.class,
RMIConnectionImpl_Stub.class,
RMIServerImpl.class,
- RMIIIOPServerImpl.class,
RMIJRMPServerImpl.class
};
--- a/jdk/test/javax/management/remote/mandatory/connection/NoIIOP.java Thu Aug 20 07:36:37 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.
- */
-
-/* @test
- * @bug 8004502
- * @summary Sanity check that attempts to use the IIOP transport or
- * RMIIIOPServerImpl when RMI/IIOP not present throws the expected exceptions
- * @modules java.management
- */
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.remote.*;
-import javax.management.remote.rmi.*;
-import java.net.MalformedURLException;
-import java.io.IOException;
-import javax.security.auth.Subject;
-import java.rmi.NoSuchObjectException;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXConnectorServerFactory;
-
-public class NoIIOP {
-
- /**
- * RMIIIOPServerImpl implementation for testing purposes (methods are
- * overridden to be public to allow for testing)
- */
- static class MyRMIIIOPServerImpl extends RMIIIOPServerImpl {
- MyRMIIIOPServerImpl() throws IOException {
- super(null);
- }
- @Override
- public void export() throws IOException {
- super.export();
- }
- @Override
- public String getProtocol() {
- return super.getProtocol();
- }
- @Override
- public RMIConnection makeClient(String connectionId, Subject subject)
- throws IOException
- {
- return super.makeClient(connectionId, subject);
- }
- @Override
- public void closeClient(RMIConnection client) throws IOException {
- super.closeClient(client);
- }
- @Override
- public void closeServer() throws IOException {
- super.closeServer();
- }
- }
-
-
- public static void main(String[] args) throws Exception {
- try {
- Class.forName("javax.management.remote.rmi._RMIConnectionImpl_Tie");
- System.out.println("RMI/IIOP appears to be supported, test skipped");
- return;
- } catch (ClassNotFoundException okay) { }
-
- JMXServiceURL url = new JMXServiceURL("service:jmx:iiop://");
- MBeanServer mbs = MBeanServerFactory.createMBeanServer();
-
-
- // test JMXConnectorFactory/JMXConnectorServerFactory
-
- try {
- JMXConnectorFactory.connect(url);
- throw new RuntimeException("connect did not throw MalformedURLException");
- } catch (MalformedURLException expected) { }
-
- try {
- JMXConnectorServerFactory.newJMXConnectorServer(url, null, null);
- throw new RuntimeException("newJMXConnectorServer did not throw MalformedURLException");
- } catch (MalformedURLException expected) { }
-
-
- // test RMIConnector/RMIConnectorServer
-
- RMIConnector connector = new RMIConnector(url, null);
- try {
- connector.connect();
- throw new RuntimeException("connect did not throw IOException");
- } catch (IOException expected) { }
-
- RMIConnectorServer server = new RMIConnectorServer(url, null, mbs);
- try {
- server.start();
- throw new RuntimeException("start did not throw IOException");
- } catch (IOException expected) { }
-
-
- // test RMIIIOPServerImpl
-
- MyRMIIIOPServerImpl impl = new MyRMIIIOPServerImpl();
- impl.setMBeanServer(mbs);
- System.out.println(impl.getProtocol());
-
- try {
- impl.export();
- throw new RuntimeException("export did not throw IOException");
- } catch (IOException expected) { }
-
- try {
- impl.newClient(null);
- throw new RuntimeException("newClient did not throw IOException");
- } catch (IOException expected) { }
-
- try {
- impl.toStub();
- throw new RuntimeException("toStub did not throw NoSuchObjectException");
- } catch (NoSuchObjectException expected) { }
-
- try {
- impl.closeServer();
- throw new RuntimeException("closeServer did not throw NoSuchObjectException");
- } catch (NoSuchObjectException expected) { }
- }
-}