[jboss-remoting-commits] JBoss Remoting SVN: r4124 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed May 7 04:18:29 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-05-07 04:18:28 -0400 (Wed, 07 May 2008)
New Revision: 4124

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-977: (1) Treats passed ServerInvocationHandlers as if they might be proxies; (2) wraps newly created ServerInvocationHandler proxies.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2008-05-07 08:05:58 UTC (rev 4123)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2008-05-07 08:18:28 UTC (rev 4124)
@@ -28,6 +28,7 @@
 import org.jboss.remoting.InvokerRegistry;
 import org.jboss.remoting.ServerConfiguration;
 import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvocationHandlerWrapper;
 import org.jboss.remoting.ServerInvoker;
 import org.jboss.remoting.marshal.MarshalFactory;
 import org.jboss.remoting.marshal.MarshallLoaderFactory;
@@ -45,8 +46,6 @@
 import javax.management.ObjectName;
 import javax.net.ServerSocketFactory;
 import javax.net.SocketFactory;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
@@ -891,6 +890,7 @@
                                                              objName,
                                                              ServerInvocationHandler.class,
                                                              false);
+         handler = new ServerInvocationHandlerWrapper(handler);
       }
       else
       {
@@ -1212,7 +1212,7 @@
     * description = "The ServerInvocationHandler we are registering
     * for the subsystem"
     */
-   public ServerInvocationHandler addInvocationHandler(String subsystem, ServerInvocationHandler handler)
+   public ServerInvocationHandler addInvocationHandler(String subsystem, final ServerInvocationHandler handler)
          throws Exception
    {
       if (invoker == null)
@@ -1220,7 +1220,15 @@
          throw new IllegalStateException("You may only add handlers once the Connector is created (via create() method).");
       }
 
-      handler.setMBeanServer(server);
+      // In case handler is an MBean.
+      AccessController.doPrivileged( new PrivilegedAction()
+      {
+         public Object run()
+         {
+            handler.setMBeanServer(server);
+            return null;
+         }
+      });
       return invoker.addInvocationHandler(subsystem, handler);
    }
 




More information about the jboss-remoting-commits mailing list