Class JolokiaMBeanServerUtil

java.lang.Object
org.jolokia.support.jmx.JolokiaMBeanServerUtil

public final class JolokiaMBeanServerUtil extends Object
Utility class for looking up the Jolokia-internal MBeanServer which never gets exposed via JSR-160
Since:
13.01.13
Author:
roland
  • Method Details

    • getJolokiaMBeanServer

      public static MBeanServer 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 Jolokia Serializer is registered as a service. So, it can return null e.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

      Register an MBean at the JolokiaMBeanServer. This call is directly delegated to the JolokiaMBeanServer
      Parameters:
      object - object to register
      name - object name under which to register the MBean
      Returns:
      the object instance created
      Throws:
      InstanceAlreadyExistsException
      MBeanRegistrationException
      NotCompliantMBeanException
    • 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:
      InstanceNotFoundException
      MBeanRegistrationException