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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Sat Jul 3 13:19:32 EDT 2010


Author: ron.sigal at jboss.com
Date: 2010-07-03 13:19:32 -0400 (Sat, 03 Jul 2010)
New Revision: 5888

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-1231: Wrapped all state changing calls to InvokerRegistry in PrivilegedAction.

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	2010-07-03 17:18:54 UTC (rev 5887)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2010-07-03 17:19:32 UTC (rev 5888)
@@ -415,12 +415,26 @@
          throw new IllegalStateException("Connector not configured with LocatorURI.");
       }
 
-      InvokerLocator locator = new InvokerLocator(locatorURI);
+      final InvokerLocator locator = new InvokerLocator(locatorURI);
 
       if (invoker == null)
       {
          // create the server invoker
-         invoker = InvokerRegistry.createServerInvoker(locator, configuration);
+         try
+         {
+            invoker = (ServerInvoker) AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+               public Object run() throws Exception
+               {
+                  return  InvokerRegistry.createServerInvoker(locator, configuration);
+               }
+            });
+         }
+         catch (PrivilegedActionException pae)
+         {
+            throw pae.getException();
+         }
+         
          invoker.setMBeanServer(server);
 
          // set the server socket factory if has been already set on the connector
@@ -1128,7 +1142,16 @@
             log.trace(this + " shutting down server invoker");
             invoker.stop();
             invoker.destroy();
-            InvokerRegistry.destroyServerInvoker(invoker);
+            
+            AccessController.doPrivileged( new PrivilegedAction()
+            {
+               public Object run()
+               {
+                  InvokerRegistry.destroyServerInvoker(invoker);
+                  return null;
+               }
+            });
+            
             invoker = null;
          }
          if (marshallerLoaderConnector != null && marshallerLoaderConnector.isStarted)
@@ -1164,7 +1187,16 @@
             {
                invoker.stop();
                invoker.destroy();
-               InvokerRegistry.destroyServerInvoker(invoker);
+               
+               AccessController.doPrivileged( new PrivilegedAction()
+               {
+                  public Object run()
+                  {
+                     InvokerRegistry.destroyServerInvoker(invoker);
+                     return null;
+                  }
+               });
+               
                invoker = null;
             }
             isCreated = false;
@@ -1188,7 +1220,16 @@
       {
          invoker.stop();
          invoker.destroy();
-         InvokerRegistry.destroyServerInvoker(invoker);
+         
+         AccessController.doPrivileged( new PrivilegedAction()
+         {
+            public Object run()
+            {
+               InvokerRegistry.destroyServerInvoker(invoker);
+               return null;
+            }
+         });
+         
          invoker = null;
       }
       isCreated = false;



More information about the jboss-remoting-commits mailing list