Class AbstractJolokiaService<T extends JolokiaService<?>>

java.lang.Object
org.jolokia.server.core.service.api.AbstractJolokiaService<T>
All Implemented Interfaces:
Comparable<T>, JolokiaService<T>
Direct Known Subclasses:
AbstractRequestHandler, DebugStore, VersionRequestHandler

public abstract class AbstractJolokiaService<T extends JolokiaService<?>> extends Object implements JolokiaService<T>
Abstract base class for JolokiaServices.
Since:
22.04.13
Author:
roland
  • Constructor Details

    • AbstractJolokiaService

      protected AbstractJolokiaService(Class<T> pType, int pOrderId)
      Construction of a base service for a given type and order
      Parameters:
      pType - service type
      pOrderId - order id. A user of JolokiaService must ensure that the given order id is unique for the given type. It used for ordering the services but is also used as an id when storing it in a set.
  • Method Details

    • getOrder

      public int getOrder()
      Order of the service. The higher the number, the later in the list of services this service appears. Default order is 100.
      Specified by:
      getOrder in interface JolokiaService<T extends JolokiaService<?>>
      Returns:
      the order of this service
    • getType

      public Class<T> getType()
      The service type which is used to distinguish the various services. The service type is an extension of this base interface and add service specific methods to it
      Specified by:
      getType in interface JolokiaService<T extends JolokiaService<?>>
      Returns:
      service type
    • destroy

      public void destroy() throws Exception
      Override for hooking into the lifecycle
      Specified by:
      destroy in interface JolokiaService<T extends JolokiaService<?>>
      Throws:
      Exception
    • init

      public void init(JolokiaContext pJolokiaContext)
      Override if access to the JolokiaContext is required.
      Specified by:
      init in interface JolokiaService<T extends JolokiaService<?>>
      Parameters:
      pJolokiaContext - JolokiaContext used
    • compareTo

      public int compareTo(T pOtherService)
      Specified by:
      compareTo in interface Comparable<T extends JolokiaService<?>>
    • registerJolokiaMBean

      protected ObjectName registerJolokiaMBean(String pName, Object pMBean)
      Register an MBean with a unique qualifier for this agent.
      Parameters:
      pName - name of the MBean to register
      pMBean - the MBean to register
    • unregisterJolokiaMBean

      protected void unregisterJolokiaMBean(ObjectName oName)
      Unregister MBean with the given name. If it hasn't been registered before with registerJolokiaMBean(String, Object) then this is a no-op. Also, any error is logged but wont result in any exception
      Parameters:
      oName - name as returned during registration. If null, nothing happens
    • getJolokiaContext

      protected JolokiaContext getJolokiaContext()