Package org.jolokia.support.jmx
Class JolokiaMBeanServerUtil
java.lang.Object
org.jolokia.support.jmx.JolokiaMBeanServerUtil
Utility class for looking up the Jolokia-internal MBeanServer which never gets exposed via JSR-160
- Since:
- 13.01.13
- Author:
- roland
-
Method Summary
Modifier and TypeMethodDescriptionstatic MBeanServerLookup the JolokiaMBean server via a JMX lookup to the Jolokia-internal MBean exposing this MBeanServer.static ObjectInstanceregisterMBean(Object object, ObjectName name) Register an MBean at the JolokiaMBeanServer.static voidunregisterMBean(ObjectName name) Unregister an MBean at the JolokiaMBeanServer.
-
Method Details
-
getJolokiaMBeanServer
Lookup the JolokiaMBean server via a JMX lookup to the Jolokia-internal MBean exposing this MBeanServer. Note if this method is used in an OSGi environment, it will only return non-null if a JolokiaSerializeris registered as a service. So, it can returnnulle.g. during startup of an OSGi container. The client must deal with a null-return value and wait until this bundle has been started. After this, a service tracker is used as a proxy for the serializer service, which, when called without an registered serializer service will throw an exception. If used in a non-OSGi environment and the class "org.jolokia.service.serailizer.JolokiaSerializer" is on the classpath, this method will return the requested MBeanServer, (always) null otherwise .- Returns:
- the Jolokia MBeanServer or null if not yet available present
-
registerMBean
public static ObjectInstance registerMBean(Object object, ObjectName name) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException Register an MBean at the JolokiaMBeanServer. This call is directly delegated to the JolokiaMBeanServer- Parameters:
object- object to registername- object name under which to register the MBean- Returns:
- the object instance created
- Throws:
InstanceAlreadyExistsExceptionMBeanRegistrationExceptionNotCompliantMBeanException
-
unregisterMBean
public static void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException Unregister an MBean at the JolokiaMBeanServer. This call is directly delegated to the JolokiaMBeanServer- Parameters:
name- objectname of the MBean to unregister- Throws:
InstanceNotFoundExceptionMBeanRegistrationException
-