Author: ron.sigal(a)jboss.com
Date: 2008-05-20 21:59:13 -0400 (Tue, 20 May 2008)
New Revision: 4204
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
Log:
JBREM-980: Moved validateLocator() from ServerInvoker to InvokerLocator.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2008-05-21
01:58:36 UTC (rev 4203)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2008-05-21
01:59:13 UTC (rev 4204)
@@ -55,10 +55,6 @@
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -1046,7 +1042,7 @@
{
try
{
- maxOnewayThreadPoolQueueSize = Integer.parseInt((String) param);
+ maxOnewayThreadPoolQueueSize = Integer.parseInt(param);
}
catch (NumberFormatException e)
{
@@ -1096,7 +1092,11 @@
createServerSocketFactory();
// need to check invoker locator to see if need to provide binding address (in the
case 0.0.0.0 was used)
- locator = validateLocator(locator);
+ InvokerLocator originalLocator = locator;
+ locator = InvokerLocator.validateLocator(locator);
+
+ // need to update the locator key used in the invoker registry
+ InvokerRegistry.updateServerInvokerLocator(originalLocator, locator);
}
protected void setupHomes(Map config) throws Exception
@@ -1257,60 +1257,6 @@
return homes;
}
- /**
- * InvokerLocator leaves address 0.0.0.0 unchanged. Once serverBindAddress has been
- * extracted from the InvokerLocator, it is necessary to transform 0.0.0.0 into an
- * address that contacted over the network. See JBREM-687.
- */
- private InvokerLocator validateLocator(InvokerLocator locator) throws
MalformedURLException
- {
- InvokerLocator externalLocator = locator;
-
- String host = locator.getHost();
- String newHost = null;
- if(host == null || InvokerLocator.ANY.equals(host))
- {
- // now need to get some external bindable address
- try
- {
- newHost = (String)AccessController.doPrivileged( new
PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- String bindByHost = System.getProperty(InvokerLocator.BIND_BY_HOST,
"True");
- boolean byHost = Boolean.valueOf(bindByHost).booleanValue();
- if(byHost)
- {
- return InetAddress.getLocalHost().getHostName();
- }
- else
- {
- return InetAddress.getLocalHost().getHostAddress();
- }
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- log.debug("Could not get host by name or address.", e.getCause());
- }
-
- if(newHost == null)
- {
- // now what? step through network interfaces?
- throw new RuntimeException("Can not determine bindable address for
locator (" + locator + ")");
- }
-
- externalLocator = new InvokerLocator(locator.protocol, newHost, locator.port,
- locator.getPath(),
locator.getParameters());
-
- // need to update the locator key used in the invoker registry
- InvokerRegistry.updateServerInvokerLocator(locator, externalLocator);
- }
-
- return externalLocator;
- }
-
protected int assignPort() throws IOException
{
int port;
Show replies by date