Author: ron.sigal(a)jboss.com
Date: 2010-07-03 13:18:54 -0400 (Sat, 03 Jul 2010)
New Revision: 5887
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
Log:
JBREM-1231: Wrapped all state changing calls to InvokerRegistry in PrivilegedAction.
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-03
17:18:25 UTC (rev 5886)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2010-07-03
17:18:54 UTC (rev 5887)
@@ -57,6 +57,7 @@
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;
@@ -1158,7 +1159,7 @@
createServerSocketFactory();
// need to check invoker locator to see if need to provide binding address (in the
case 0.0.0.0 was used)
- InvokerLocator originalLocator = locator;
+ final InvokerLocator originalLocator = locator;
locator = InvokerLocator.validateLocator(locator);
if (!locator.getLocatorURI().equals(originalLocator.getLocatorURI())) {
log.debug(this + " original locator: " + originalLocator);
@@ -1166,7 +1167,14 @@
}
// need to update the locator key used in the invoker registry
- InvokerRegistry.updateServerInvokerLocator(originalLocator, locator);
+ AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ InvokerRegistry.updateServerInvokerLocator(originalLocator, locator);
+ return null;
+ }
+ });
}
protected void setupHomes(Map config) throws Exception
@@ -1333,11 +1341,19 @@
port = PortUtil.findFreePort(locator.getHost());
// re-write locator since the port is different
- InvokerLocator newLocator = new InvokerLocator(locator.getProtocol(),
locator.getHost(), port,
+ final InvokerLocator newLocator = new InvokerLocator(locator.getProtocol(),
locator.getHost(), port,
locator.getPath(),
locator.getParameters());
// need to update the locator key used in the invoker registry
- InvokerRegistry.updateServerInvokerLocator(locator, newLocator);
+ AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ InvokerRegistry.updateServerInvokerLocator(locator, newLocator);
+ return null;
+ }
+ });
+
this.locator = newLocator;
return port;
}
Show replies by date