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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Apr 11 21:43:43 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-04-11 21:43:43 -0400 (Fri, 11 Apr 2008)
New Revision: 3964

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility calls..

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java	2008-04-12 01:43:08 UTC (rev 3963)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java	2008-04-12 01:43:43 UTC (rev 3964)
@@ -25,6 +25,7 @@
 import org.jboss.remoting.Home;
 import org.jboss.remoting.InvokerLocator;
 import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.util.SecurityUtility;
 import org.jboss.remoting.util.TimerUtil;
 import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
 import org.jboss.util.propertyeditor.PropertyEditors;
@@ -311,26 +312,8 @@
       
       ss.setReuseAddress(getReuseAddress());
       configureServerSocket(ss);
-      final InetSocketAddress address = new InetSocketAddress(bindAddress, serverBindPort);
-      final ServerSocket finalServerSocket = ss;
-      
-      try
-      {
-          AccessController.doPrivileged( new PrivilegedExceptionAction()
-          {
-             public Object run() throws Exception
-             {
-                finalServerSocket.bind(address, backlog);
-                return null;
-             }
-          });
-      }
-      catch (PrivilegedActionException e)
-      {
-          throw (IOException) e.getCause();
-      }
-      
-
+      InetSocketAddress address = new InetSocketAddress(bindAddress, serverBindPort);
+      SecurityUtility.bind(ss, address, backlog);
       return ss;
    }
    
@@ -342,22 +325,7 @@
       while (it.hasNext())
       {
          Home home = (Home) it.next();
-         InetAddress inetAddress = null;
-         try
-         {
-            final Home finalHome = home;
-            inetAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
-            {
-               public Object run() throws UnknownHostException
-               {
-                  return InetAddress.getByName(finalHome.host);
-               }
-            });
-         }
-         catch (PrivilegedActionException e)
-         {
-            throw (UnknownHostException) e.getCause();
-         }
+         InetAddress inetAddress = SecurityUtility.getAddressByName(home.host);
          
          ServerSocket ss = null;
          try
@@ -366,7 +334,7 @@
             ss.setReuseAddress(getReuseAddress());
             configureServerSocket(ss);
             InetSocketAddress address = new InetSocketAddress(inetAddress, home.port);
-            ss.bind(address, backlog);
+            SecurityUtility.bind(ss, address, backlog);
             if (log.isDebugEnabled()) log.debug(this + " created " + ss);
          }
          catch (SocketException e)
@@ -1028,22 +996,7 @@
 
                if(trace) { log.trace(this + " is going to wait on serverSocket.accept()"); }
 
-               Socket socket = null;
-               try
-               {
-                   socket = (Socket)AccessController.doPrivileged( new PrivilegedExceptionAction()
-                   {
-                      public Object run() throws Exception
-                      {
-                          return serverSocket.accept();
-                      }
-                   });
-               }
-               catch (PrivilegedActionException e)
-               {
-                   throw (IOException) e.getCause();
-               }
-
+               Socket socket = SecurityUtility.accept(serverSocket);
                if(trace) { log.trace(this + " accepted " + socket); }
 
                // the acceptor thread should spend as little time as possbile doing any kind of




More information about the jboss-remoting-commits mailing list