[jboss-remoting-commits] JBoss Remoting SVN: r3798 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Thu Mar 27 03:03:12 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-03-27 03:03:12 -0400 (Thu, 27 Mar 2008)
New Revision: 3798
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-934: Put MBeanServer.registerMBean(), MBeanServer.unregisterMBean() in AccessController.doPrivileged() calls.
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 2008-03-27 07:01:10 UTC (rev 3797)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2008-03-27 07:03:12 UTC (rev 3798)
@@ -24,7 +24,6 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.ConnectionListener;
-import org.jboss.remoting.Home;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.InvokerRegistry;
import org.jboss.remoting.ServerConfiguration;
@@ -46,7 +45,9 @@
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
import java.net.InetAddress;
-import java.util.ArrayList;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -430,10 +431,24 @@
{
try
{
- ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
+ final ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
if (!server.isRegistered(objName))
- {
- server.registerMBean(invoker, objName);
+ {
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ server.registerMBean(invoker, objName);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (Exception) e.getCause();
+ }
}
else
{
@@ -962,8 +977,22 @@
{
try
{
- ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
- server.unregisterMBean(objName);
+ final ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ server.unregisterMBean(objName);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (Exception) e.getCause();
+ }
}
catch (Exception e)
{
More information about the jboss-remoting-commits
mailing list