Author: ron.sigal(a)jboss.com
Date: 2010-07-03 09:29:11 -0400 (Sat, 03 Jul 2010)
New Revision: 5881
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
Log:
JBREM-1231: Wrapped all state changing calls to InvokerRegistry in PrivilegedAction.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2010-06-25 00:19:09 UTC
(rev 5880)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2010-07-03 13:29:11 UTC
(rev 5881)
@@ -362,7 +362,20 @@
try
{
- this.invoker = InvokerRegistry.createClientInvoker(locator,
configuration);
+ try
+ {
+ this.invoker = (ClientInvoker) AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return InvokerRegistry.createClientInvoker(locator,
configuration);
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ throw pae.getException();
+ }
if(wasConnected)
{
connect();
@@ -629,7 +642,21 @@
configuration.put(Remoting.CUSTOM_SOCKET_FACTORY, socketFactory);
this.socketFactory = null;
}
- invoker = InvokerRegistry.createClientInvoker(locator, configuration);
+ try
+ {
+ invoker = (ClientInvoker) AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return InvokerRegistry.createClientInvoker(locator, configuration);
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ throw pae.getException();
+ }
+
}
connect(invoker, listener, metadata);
@@ -684,7 +711,14 @@
}
else
{
- InvokerRegistry.destroyClientInvoker(invoker.getLocator(), configuration);
+ AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ InvokerRegistry.destroyClientInvoker(invoker.getLocator(),
configuration);
+ return null;
+ }
+ });
}
invoker = null;
@@ -2064,7 +2098,23 @@
private void configureCallbackServerSocketFactory(Map map) throws Exception
{
- if (InvokerRegistry.isSSLSupported(locator.getProtocol()) &&
+ Boolean supportsSSL = null;
+ try
+ {
+ supportsSSL = (Boolean) AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return new
Boolean(InvokerRegistry.isSSLSupported(locator.getProtocol()));
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ throw pae.getException();
+ }
+
+ if (supportsSSL.booleanValue() &&
!map.containsKey(Remoting.CUSTOM_SERVER_SOCKET_FACTORY) &&
!map.containsKey(ServerInvoker.SERVER_SOCKET_FACTORY) &&
!map.containsKey(SSLSocketBuilder.REMOTING_SERVER_SOCKET_USE_CLIENT_MODE))
@@ -2087,7 +2137,14 @@
public void run()
{
log.debug(this + " calling InvokerRegistry.destroyClientInvoker() for
" + invoker);
- InvokerRegistry.destroyClientInvoker(invoker.getLocator(), config);
+ AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ InvokerRegistry.destroyClientInvoker(invoker.getLocator(), config);
+ return null;
+ }
+ });
synchronized (invokerDestructionTimerLock)
{
Show replies by date