Package org.infinispan.commons.jmx
Class JmxUtil
- java.lang.Object
-
- org.infinispan.commons.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(String domain, MBeanServer mBeanServer, String groupName)
Build the JMX domain name.static MBeanServer
lookupMBeanServer(MBeanServerLookup lookup, Properties properties)
Looks up theMBeanServer
instance.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(MBeanServerLookup lookup, Properties properties)
Looks up theMBeanServer
instance.- Parameters:
lookup
- instance ofMBeanServerLookup
to use for obtaining the MBeanServerproperties
- any properties required by theMBeanServerLookup
implementation- Returns:
- an instance of
MBeanServer
-
buildJmxDomain
public static String buildJmxDomain(String domain, MBeanServer mBeanServer, String groupName)
Build the JMX domain name.- Parameters:
domain
- The JMX domain namemBeanServer
- 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
-
-