[jboss-remoting-commits] JBoss Remoting SVN: r5921 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Thu Jul 22 11:53:20 EDT 2010


Author: ron.sigal at jboss.com
Date: 2010-07-22 11:53:20 -0400 (Thu, 22 Jul 2010)
New Revision: 5921

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDetector.java
Log:
JBREM-1234: Gets localhost in a static block; made Logger static.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDetector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDetector.java	2010-07-22 15:52:45 UTC (rev 5920)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDetector.java	2010-07-22 15:53:20 UTC (rev 5921)
@@ -39,7 +39,6 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 
-import java.io.IOException;
 import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -98,7 +97,7 @@
    private int detectionNumber = 5;
    private int cleanDetectionCount = detectionNumber;
 
-   protected final Logger log = Logger.getLogger(getClass());
+   protected static final Logger log = Logger.getLogger(JNDIDetector.class);
    
    public JNDIDetector()
    {
@@ -577,67 +576,20 @@
       }
    }
    
-   static private InetAddress getLocalHost() throws UnknownHostException
-   {
-      if (SecurityUtility.skipAccessControl())
-      {
-         try
-         {
-            return InetAddress.getLocalHost();
-         }
-         catch (IOException e)
-         {
-            return InetAddress.getByName("127.0.0.1");
-         }
-      }
-
-      try
-      {
-         return (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
-         {
-            public Object run() throws IOException
-            {
-               try
-               {
-                  return InetAddress.getLocalHost();
-               }
-               catch (IOException e)
-               {
-                  return InetAddress.getByName("127.0.0.1");
-               }
-            }
-         });
-      }
-      catch (PrivilegedActionException e)
-      {
-         throw (UnknownHostException) e.getCause();
-      }
-   }
-   
    static private String getLocalHostName() throws UnknownHostException
    {
       if (SecurityUtility.skipAccessControl())
       {
-         return getLocalHost().getHostName();
+         return doGetLocalHost().getHostName();
       }
 
       try
       {
          return (String) AccessController.doPrivileged( new PrivilegedExceptionAction()
          {
-            public Object run() throws IOException
+            public Object run() throws UnknownHostException
             {
-               InetAddress address = null;
-               try
-               {
-                  address = InetAddress.getLocalHost();
-               }
-               catch (IOException e)
-               {
-                  address = InetAddress.getByName("127.0.0.1");
-               }
-               
-               return address.getHostName();
+               return doGetLocalHost().getHostName();
             }
          });
       }



More information about the jboss-remoting-commits mailing list