JBoss Remoting SVN: r5925 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-07-22 11:55:52 -0400 (Thu, 22 Jul 2010)
New Revision: 5925
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-1234: Gets localhost in a static block; made Logger static.
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-22 15:55:26 UTC (rev 5924)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2010-07-22 15:55:52 UTC (rev 5925)
@@ -151,8 +151,40 @@
private boolean isStarted = false;
private boolean isCreated = false;
- protected final Logger log = Logger.getLogger(getClass());
+ protected static final Logger log = Logger.getLogger(Connector.class);
+ private static final InetAddress LOCAL_HOST;
+ static
+ {
+ try
+ {
+ LOCAL_HOST = (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ log.debug(Connector.class.getName() + " unable to get local host address", e.getCause());
+ throw new ExceptionInInitializerError(e.getCause());
+ }
+ catch (SecurityException e)
+ {
+ log.debug(Connector.class.getName() + " unable to get local host address", e);
+ throw e;
+ }
+ }
+
/**
* Empty constructor.
*/
@@ -1540,30 +1572,16 @@
{
if (SecurityUtility.skipAccessControl())
{
- try
- {
- return InetAddress.getLocalHost();
- }
- catch (IOException e)
- {
- return InetAddress.getByName("127.0.0.1");
- }
+ return doGetLocalHost();
}
try
{
return (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
{
- public Object run() throws IOException
+ public Object run() throws UnknownHostException
{
- try
- {
- return InetAddress.getLocalHost();
- }
- catch (IOException e)
- {
- return InetAddress.getByName("127.0.0.1");
- }
+ return doGetLocalHost();
}
});
}
@@ -1572,4 +1590,21 @@
throw (UnknownHostException) e.getCause();
}
}
+
+ static private InetAddress doGetLocalHost() throws UnknownHostException
+ {
+ if (LOCAL_HOST != null)
+ {
+ return LOCAL_HOST;
+ }
+
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
}
14 years, 4 months
JBoss Remoting SVN: r5924 - remoting2/branches/2.x/src/main/org/jboss/remoting/stream.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-07-22 11:55:26 -0400 (Thu, 22 Jul 2010)
New Revision: 5924
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java
Log:
JBREM-1234: Gets localhost in a static block.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java 2010-07-22 15:54:55 UTC (rev 5923)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java 2010-07-22 15:55:26 UTC (rev 5924)
@@ -73,7 +73,39 @@
public static final String STREAM_HOST_KEY = "remoting.stream.host";
public static final String STREAM_PORT_KEY = "remoting.stream.port";
+ private static final InetAddress LOCAL_HOST;
+ static
+ {
+ try
+ {
+ LOCAL_HOST = (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ log.debug(StreamServer.class.getName() + " unable to get local host address", e.getCause());
+ throw new ExceptionInInitializerError(e.getCause());
+ }
+ catch (SecurityException e)
+ {
+ log.debug(StreamServer.class.getName() + " unable to get local host address", e);
+ throw e;
+ }
+ }
+
/**
* Creates the server wrapped around the specified input stream.
* This will create the remoting server as well.
@@ -342,30 +374,16 @@
{
if (SecurityUtility.skipAccessControl())
{
- try
- {
- return InetAddress.getLocalHost();
- }
- catch (IOException e)
- {
- return InetAddress.getByName("127.0.0.1");
- }
+ return doGetLocalHost();
}
try
{
return (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
{
- public Object run() throws IOException
+ public Object run() throws UnknownHostException
{
- try
- {
- return InetAddress.getLocalHost();
- }
- catch (IOException e)
- {
- return InetAddress.getByName("127.0.0.1");
- }
+ return doGetLocalHost();
}
});
}
@@ -375,30 +393,37 @@
}
}
+ static private InetAddress doGetLocalHost() throws UnknownHostException
+ {
+ if (LOCAL_HOST != null)
+ {
+ return LOCAL_HOST;
+ }
+
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+
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();
}
});
}
14 years, 4 months
JBoss Remoting SVN: r5923 - remoting2/branches/2.x/src/main/org/jboss/remoting/ident.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-07-22 11:54:55 -0400 (Thu, 22 Jul 2010)
New Revision: 5923
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java
Log:
JBREM-1234: Gets localhost in a static block; added Logger.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java 2010-07-22 15:54:27 UTC (rev 5922)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java 2010-07-22 15:54:55 UTC (rev 5923)
@@ -21,6 +21,7 @@
*/
package org.jboss.remoting.ident;
+import org.jboss.logging.Logger;
import org.jboss.remoting.network.NetworkRegistry;
import org.jboss.remoting.util.SecurityUtility;
@@ -66,7 +67,81 @@
}
private static transient Map identities = new WeakHashMap(2);
+
+ private static final Logger log = Logger.getLogger(Identity.class);
+ private static final InetAddress LOCAL_HOST;
+ static
+ {
+ try
+ {
+ LOCAL_HOST = (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ log.debug(Identity.class.getName() + " unable to get local host address", e.getCause());
+ throw new ExceptionInInitializerError(e.getCause());
+ }
+ catch (SecurityException e)
+ {
+ log.debug(Identity.class.getName() + " unable to get local host address", e);
+ throw e;
+ }
+ }
+
+ static private InetAddress getLocalHost() throws UnknownHostException
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ return doGetLocalHost();
+ }
+
+ try
+ {
+ return (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return doGetLocalHost();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+ }
+
+ static private InetAddress doGetLocalHost() throws UnknownHostException
+ {
+ if (LOCAL_HOST != null)
+ {
+ return LOCAL_HOST;
+ }
+
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+
private final String instanceid;
private final InetAddress ip;
private final String serverid;
@@ -562,41 +637,4 @@
throw (RuntimeException) e.getCause();
}
}
-
- 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();
- }
- }
}
14 years, 4 months
JBoss Remoting SVN: r5922 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-07-22 11:54:27 -0400 (Thu, 22 Jul 2010)
New Revision: 5922
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java
Log:
JBREM-1234: Uses localhost obtained in AbstractDetector's static block.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java 2010-07-22 15:53:20 UTC (rev 5921)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java 2010-07-22 15:54:27 UTC (rev 5922)
@@ -372,43 +372,6 @@
}
}
- 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 InetAddress getAddressByName(final String host) throws UnknownHostException
{
if (SecurityUtility.skipAccessControl())
14 years, 4 months
JBoss Remoting SVN: r5921 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)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();
}
});
}
14 years, 4 months
JBoss Remoting SVN: r5920 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-07-22 11:52:45 -0400 (Thu, 22 Jul 2010)
New Revision: 5920
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/detection/AbstractDetector.java
Log:
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/AbstractDetector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/AbstractDetector.java 2010-07-22 15:52:22 UTC (rev 5919)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/AbstractDetector.java 2010-07-22 15:52:45 UTC (rev 5920)
@@ -32,6 +32,7 @@
import org.jboss.remoting.network.NetworkRegistryFinder;
import org.jboss.remoting.network.NetworkRegistryMBean;
import org.jboss.remoting.network.NetworkRegistryWrapper;
+import org.jboss.remoting.util.SecurityUtility;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -40,8 +41,12 @@
import javax.management.MBeanServerInvocationHandler;
import javax.management.ObjectName;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -80,7 +85,81 @@
private boolean acceptLocal = false;
private Map config;
+
+
+ private static final InetAddress LOCAL_HOST;
+ static
+ {
+ try
+ {
+ LOCAL_HOST = (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ log.debug(AbstractDetector.class.getName() + " unable to get local host address", e.getCause());
+ throw new ExceptionInInitializerError(e.getCause());
+ }
+ catch (SecurityException e)
+ {
+ log.debug(AbstractDetector.class.getName() + " unable to get local host address", e);
+ throw e;
+ }
+ }
+
+ static protected InetAddress getLocalHost() throws UnknownHostException
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ return doGetLocalHost();
+ }
+
+ try
+ {
+ return (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return doGetLocalHost();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+ }
+
+ static protected InetAddress doGetLocalHost() throws UnknownHostException
+ {
+ if (LOCAL_HOST != null)
+ {
+ return LOCAL_HOST;
+ }
+
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+
public AbstractDetector()
{
this(null);
14 years, 4 months
JBoss Remoting SVN: r5919 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-07-22 11:52:22 -0400 (Thu, 22 Jul 2010)
New Revision: 5919
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
Log:
JBREM-1234: Gets localhost in a static block.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2010-07-22 15:51:49 UTC (rev 5918)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2010-07-22 15:52:22 UTC (rev 5919)
@@ -230,7 +230,39 @@
// Static ---------------------------------------------------------------------------------------
private static boolean trace = log.isTraceEnabled();
+ private static final InetAddress LOCAL_HOST;
+ static
+ {
+ try
+ {
+ LOCAL_HOST = (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ log.debug(ServerInvoker.class.getName() + " unable to get local host address", e.getCause());
+ throw new ExceptionInInitializerError(e.getCause());
+ }
+ catch (SecurityException e)
+ {
+ log.debug(ServerInvoker.class.getName() + " unable to get local host address", e);
+ throw e;
+ }
+ }
+
// Attributes -----------------------------------------------------------------------------------
/**
@@ -2203,30 +2235,16 @@
{
if (SecurityUtility.skipAccessControl())
{
- try
- {
- return InetAddress.getLocalHost();
- }
- catch (IOException e)
- {
- return InetAddress.getByName("127.0.0.1");
- }
+ return doGetLocalHost();
}
try
{
return (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
{
- public Object run() throws IOException
+ public Object run() throws UnknownHostException
{
- try
- {
- return InetAddress.getLocalHost();
- }
- catch (IOException e)
- {
- return InetAddress.getByName("127.0.0.1");
- }
+ return doGetLocalHost();
}
});
}
@@ -2236,6 +2254,23 @@
}
}
+ static private InetAddress doGetLocalHost() throws UnknownHostException
+ {
+ if (LOCAL_HOST != null)
+ {
+ return LOCAL_HOST;
+ }
+
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+
static private InetAddress getAddressByName(final String host) throws UnknownHostException
{
if (SecurityUtility.skipAccessControl())
14 years, 4 months
JBoss Remoting SVN: r5918 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-07-22 11:51:49 -0400 (Thu, 22 Jul 2010)
New Revision: 5918
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java
Log:
JBREM-1234: Gets localhost in a static block.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java 2010-07-22 15:51:21 UTC (rev 5917)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java 2010-07-22 15:51:49 UTC (rev 5918)
@@ -254,11 +254,11 @@
boolean byHost = Boolean.valueOf(bindByHost).booleanValue();
if(byHost)
{
- return InetAddress.getLocalHost().getHostName();
+ return getLocalHost().getHostName();
}
else
{
- return InetAddress.getLocalHost().getHostAddress();
+ return getLocalHost().getHostAddress();
}
}
});
@@ -347,7 +347,56 @@
return b.toString();
}
+ private static final InetAddress LOCAL_HOST;
+
+ static
+ {
+ try
+ {
+ LOCAL_HOST = (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ log.debug(InvokerLocator.class.getName() + " unable to get local host address", e.getCause());
+ throw new ExceptionInInitializerError(e.getCause());
+ }
+ catch (SecurityException e)
+ {
+ log.debug(InvokerLocator.class.getName() + " unable to get local host address", e);
+ throw e;
+ }
+ }
+ private static InetAddress getLocalHost() throws UnknownHostException
+ {
+ if (LOCAL_HOST != null)
+ {
+ return LOCAL_HOST;
+ }
+
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+
/**
* Constructs the object used to identify a remoting server via simple uri format string (e.g. socket://myhost:7000).
* Note: the uri passed may not always be the one returned via call to getLocatorURI() as may need to change if
@@ -555,11 +604,11 @@
if(byHost)
{
- return InetAddress.getLocalHost().getHostName();
+ return getLocalHost().getHostName();
}
else
{
- return InetAddress.getLocalHost().getHostAddress();
+ return getLocalHost().getHostAddress();
}
}
});
14 years, 4 months
JBoss Remoting SVN: r5917 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-07-22 11:51:21 -0400 (Thu, 22 Jul 2010)
New Revision: 5917
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
Log:
JBREM-1234: Gets localhost in a static block.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2010-07-08 21:47:19 UTC (rev 5916)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2010-07-22 15:51:21 UTC (rev 5917)
@@ -188,9 +188,82 @@
private static Object invokerDestructionTimerLock = new Object();
private static int clientCounter;
+
+ private static final InetAddress LOCAL_HOST;
// Static ---------------------------------------------------------------------------------------
+ static
+ {
+ try
+ {
+ LOCAL_HOST = (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ log.debug(Client.class.getName() + " unable to get local host address", e.getCause());
+ throw new ExceptionInInitializerError(e.getCause());
+ }
+ catch (SecurityException e)
+ {
+ log.debug(Client.class.getName() + " unable to get local host address", e);
+ throw e;
+ }
+ }
+
+ static private InetAddress getLocalHost() throws UnknownHostException
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ return doGetLocalHost();
+ }
+
+ try
+ {
+ return (InetAddress) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return doGetLocalHost();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+ }
+
+ static private InetAddress doGetLocalHost() throws UnknownHostException
+ {
+ if (LOCAL_HOST != null)
+ {
+ return LOCAL_HOST;
+ }
+
+ try
+ {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e)
+ {
+ return InetAddress.getByName("127.0.0.1");
+ }
+ }
+
// Attributes -----------------------------------------------------------------------------------
/**
@@ -2187,41 +2260,4 @@
return invoker.hashCode() * metadata.hashCode();
}
}
-
- 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();
- }
- }
}
14 years, 4 months
JBoss Remoting SVN: r5916 - in remoting3/trunk: jboss-remoting and 2 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-07-08 17:47:19 -0400 (Thu, 08 Jul 2010)
New Revision: 5916
Modified:
remoting3/trunk/jboss-remoting/pom.xml
remoting3/trunk/pom.xml
remoting3/trunk/samples/pom.xml
remoting3/trunk/taglet/pom.xml
Log:
Fix the poms so that deployment works again. The aggregator is not a parent.
Modified: remoting3/trunk/jboss-remoting/pom.xml
===================================================================
--- remoting3/trunk/jboss-remoting/pom.xml 2010-07-08 21:17:02 UTC (rev 5915)
+++ remoting3/trunk/jboss-remoting/pom.xml 2010-07-08 21:47:19 UTC (rev 5916)
@@ -29,40 +29,61 @@
<name>JBoss Remoting 3</name>
<description>JBoss Remoting 3</description>
- <parent>
- <groupId>org.jboss.remoting3</groupId>
- <artifactId>jboss-remoting-parent</artifactId>
- <version>3.1.0.Beta3-SNAPSHOT</version>
- </parent>
-
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <xnio.version>2.1.0.CR2</xnio.version>
+ <jbmar.version>1.3.0.CR3</jbmar.version>
+ </properties>
+
+ <groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting</artifactId>
+ <version>3.1.0.Beta3-SNAPSHOT</version>
+
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-api</artifactId>
+ <version>${xnio.version}</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-nio</artifactId>
+ <version>${xnio.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling</artifactId>
+ <version>${jbmar.version}</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-river</artifactId>
+ <version>${jbmar.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
+ <version>5.8</version>
<classifier>jdk15</classifier>
+ <scope>test</scope>
</dependency>
<dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
+ <version>1.1.1.GA</version>
+ <scope>test</scope>
</dependency>
</dependencies>
@@ -102,7 +123,7 @@
<configuration>
<bytecodeInjections>
<bytecodeInjection>
- <expression>${version}</expression>
+ <expression>${project.version}</expression>
<targetMembers>
<methodBodyReturn>
<className>org.jboss.remoting3.Version</className>
@@ -142,7 +163,7 @@
<tagletArtifact>
<groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting-taglet</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</tagletArtifact>
<doclet>net.gleamynode.apiviz.APIviz</doclet>
<docletArtifact>
@@ -150,9 +171,9 @@
<artifactId>apiviz</artifactId>
<version>1.3.0.GA</version>
</docletArtifact>
- <doctitle><![CDATA[JBoss Remoting ]]>${version}</doctitle>
- <header><![CDATA[JBoss Remoting ]]>${version}</header>
- <footer><![CDATA[JBoss Remoting ]]>${version}</footer>
+ <doctitle><![CDATA[JBoss Remoting ]]>${project.version}</doctitle>
+ <header><![CDATA[JBoss Remoting ]]>${project.version}</header>
+ <footer><![CDATA[JBoss Remoting ]]>${project.version}</footer>
<bottom><![CDATA[<i>Copyright © 2010 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
<links>
<link>http://java.sun.com/javase/6/docs/api/</link>
@@ -161,11 +182,20 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
+ <artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <skip>false</skip>
+ <source>1.6</source>
+ <target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Maven2 Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </distributionManagement>
</project>
Modified: remoting3/trunk/pom.xml
===================================================================
--- remoting3/trunk/pom.xml 2010-07-08 21:17:02 UTC (rev 5915)
+++ remoting3/trunk/pom.xml 2010-07-08 21:47:19 UTC (rev 5916)
@@ -26,92 +26,29 @@
<modelVersion>4.0.0</modelVersion>
- <name>JBoss Remoting 3 Parent</name>
- <description>JBoss Remoting 3 Parent POM</description>
+ <name>JBoss Remoting 3 Aggregator</name>
+ <description>JBoss Remoting 3 Aggregator POM</description>
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>5-beta-5</version>
- </parent>
-
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <xnio.version>2.1.0.CR2</xnio.version>
- <jbmar.version>1.3.0.CR3</jbmar.version>
</properties>
<groupId>org.jboss.remoting3</groupId>
- <artifactId>jboss-remoting-parent</artifactId>
- <packaging>pom</packaging>
+ <artifactId>jboss-remoting-aggregator</artifactId>
<version>3.1.0.Beta3-SNAPSHOT</version>
-
+
+ <packaging>pom</packaging>
+
<modules>
<module>taglet</module>
<module>jboss-remoting</module>
<module>samples</module>
</modules>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.xnio</groupId>
- <artifactId>xnio-api</artifactId>
- <version>${xnio.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.xnio</groupId>
- <artifactId>xnio-nio</artifactId>
- <version>${xnio.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.marshalling</groupId>
- <artifactId>jboss-marshalling</artifactId>
- <version>${jbmar.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.marshalling</groupId>
- <artifactId>jboss-marshalling-river</artifactId>
- <version>${jbmar.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.8</version>
- <classifier>jdk15</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.logmanager</groupId>
- <artifactId>jboss-logmanager</artifactId>
- <version>1.1.1.GA</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
@@ -119,4 +56,12 @@
</plugin>
</plugins>
</build>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Maven2 Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </distributionManagement>
</project>
Modified: remoting3/trunk/samples/pom.xml
===================================================================
--- remoting3/trunk/samples/pom.xml 2010-07-08 21:17:02 UTC (rev 5915)
+++ remoting3/trunk/samples/pom.xml 2010-07-08 21:47:19 UTC (rev 5916)
@@ -29,25 +29,44 @@
<name>JBoss Remoting 3 Samples</name>
<description>JBoss Remoting 3 Samples</description>
- <parent>
- <groupId>org.jboss.remoting3</groupId>
- <artifactId>jboss-remoting-parent</artifactId>
- <version>3.1.0.Beta3-SNAPSHOT</version>
- </parent>
-
+ <groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting-samples</artifactId>
+ <version>3.1.0.Beta3-SNAPSHOT</version>
+
<packaging>jar</packaging>
<dependencies>
<dependency>
- <groupId>${groupId}</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>jboss-remoting</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <version>4.8.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Maven2 Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </distributionManagement>
</project>
Modified: remoting3/trunk/taglet/pom.xml
===================================================================
--- remoting3/trunk/taglet/pom.xml 2010-07-08 21:17:02 UTC (rev 5915)
+++ remoting3/trunk/taglet/pom.xml 2010-07-08 21:47:19 UTC (rev 5916)
@@ -29,13 +29,10 @@
<name>JBoss Remoting 3 Taglet</name>
<description>JBoss Remoting 3 Documentation Taglet</description>
- <parent>
- <groupId>org.jboss.remoting3</groupId>
- <artifactId>jboss-remoting-parent</artifactId>
- <version>3.1.0.Beta3-SNAPSHOT</version>
- </parent>
+ <groupId>org.jboss.remoting3</groupId>
+ <artifactId>jboss-remoting-taglet</artifactId>
+ <version>3.1.0.Beta3-SNAPSHOT</version>
- <artifactId>jboss-remoting-taglet</artifactId>
<packaging>jar</packaging>
<dependencies>
@@ -47,4 +44,25 @@
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Maven2 Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </distributionManagement>
</project>
\ No newline at end of file
14 years, 4 months