Package org.infinispan.jmx
Class JmxUtil
- java.lang.Object
-
- org.infinispan.jmx.JmxUtil
-
public class JmxUtil extends Object
Class containing JMX related utility methods.- Since:
- 5.0
- Author:
- Galder ZamarreƱo
-
-
Constructor Summary
Constructors Constructor Description JmxUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
buildJmxDomain(GlobalConfiguration cfg, MBeanServer mBeanServer, String groupName)
Build the JMX domain name.static MBeanServer
lookupMBeanServer(GlobalConfiguration cfg)
Looks up theMBeanServer
instance based on the configuration parameters.static void
registerMBean(Object mbean, ObjectName objectName, MBeanServer mBeanServer)
Register the given dynamic JMX MBean.static void
unregisterMBean(ObjectName objectName, MBeanServer mBeanServer)
Unregister the MBean located under the givenObjectName
static int
unregisterMBeans(String filter, MBeanServer mBeanServer)
Unregister all mbeans whose object names match a given filter.
-
-
-
Method Detail
-
lookupMBeanServer
public static MBeanServer lookupMBeanServer(GlobalConfiguration cfg)
Looks up theMBeanServer
instance based on the configuration parameters.- Parameters:
cfg
- configuration instance indicating how to lookup theMBeanServer
- Returns:
- an instance of
MBeanServer
-
buildJmxDomain
public static String buildJmxDomain(GlobalConfiguration cfg, MBeanServer mBeanServer, String groupName)
Build the JMX domain name.- Parameters:
cfg
- configuration instance containig rules on JMX domains allowedmBeanServer
- theMBeanServer
where to check whether the JMX domain is allowed or not.groupName
- String containing the group name for the JMX MBean- Returns:
- A string that combines the allowed JMX domain and the group name
-
registerMBean
public static void registerMBean(Object mbean, ObjectName objectName, MBeanServer mBeanServer) throws Exception
Register the given dynamic JMX MBean.- Parameters:
mbean
- Dynamic MBean to registerobjectName
-ObjectName
under which to register the MBean.mBeanServer
-MBeanServer
where to store the MBean.- Throws:
Exception
- If registration could not be completed.
-
unregisterMBean
public static void unregisterMBean(ObjectName objectName, MBeanServer mBeanServer) throws Exception
Unregister the MBean located under the givenObjectName
- Parameters:
objectName
-ObjectName
where the MBean is registeredmBeanServer
-MBeanServer
from which to unregister the MBean.- Throws:
Exception
- If unregistration could not be completed.
-
unregisterMBeans
public static int unregisterMBeans(String filter, MBeanServer mBeanServer)
Unregister all mbeans whose object names match a given filter.- Parameters:
filter
- ObjectName-style formatted filtermBeanServer
- mbean server from which to unregister mbeans- Returns:
- number of mbeans unregistered
-
-