Package org.jboss.security.util
Class MBeanServerLocator
- java.lang.Object
-
- org.jboss.security.util.MBeanServerLocator
-
public class MBeanServerLocator extends Object
A helper class to locate an MBeanServer. MBeanServer lookup strategy enhanced to allow the explicit setting of a particular instance to be returned. This is needed to allow re-using the jdk5 ManagementFactory.getPlatformMBeanServer() as our main MBeanServer. The DefaultDomain name of this server cannot be set, and it seems to be "null" by default (probably a bug).- Version:
- $Revision: 57200 $
- Author:
- Jason Dillon, Scott.Stark@jboss.org, Dimitris Andreadis
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MBeanServer
locate()
Returns the first available MBeanServerstatic MBeanServer
locate(String agentID)
Returns the first MBeanServer registered under the agentIDstatic MBeanServer
locateJBoss()
Returns the main jboss MBeanServer.static void
setJBoss(MBeanServer server)
Optionally set the MBeanServer to be returned by calls to locateJBoss().
-
-
-
Method Detail
-
setJBoss
public static void setJBoss(MBeanServer server)
Optionally set the MBeanServer to be returned by calls to locateJBoss(). Setting this back to null reverts to the normal lookup strategy.- Parameters:
server
- the main jboss MBeanServer or null
-
locate
public static MBeanServer locate(String agentID)
Returns the first MBeanServer registered under the agentID- Parameters:
agentID
- the id of the MBeanServer to look for- Returns:
- the first MBeanServer with an agentID
-
locate
public static MBeanServer locate()
Returns the first available MBeanServer- Returns:
- the first available MBeanServer
-
locateJBoss
public static MBeanServer locateJBoss()
Returns the main jboss MBeanServer. If there is one set using setJBoss(), it will be returned. Otherwise the strategy is to return the first MBeanServer registered under the "jboss" id (or else, default domain name)- Returns:
- the main jboss MBeanServer
- Throws:
IllegalStateException
- when no MBeanServer can be found
-
-