LifecycleMBeanBase (Apache Tomcat 9.0.111 API Documentation)
Description: declaration: package: org.apache.catalina.util, class: LifecycleMBeanBase

# Class LifecycleMBeanBase

java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase

All Implemented Interfaces:
  `MBeanRegistration, JmxEnabled, Lifecycle`

Direct Known Subclasses:
  `Connector, ContainerBase, FailedContext, ManagerBase, MapperListener, NamingResourcesImpl, RealmBase, SimpleTcpCluster, StandardRoot, StandardServer, StandardService, StandardThreadExecutor, StandardVirtualThreadExecutor, ValveBase, WebappLoader`

public abstract class LifecycleMBeanBase extends LifecycleBase implements JmxEnabled

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Lifecycle

  `Lifecycle.SingleUse`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected MBeanServer`
  `mserver`
  Deprecated.

  ### Fields inherited from interface Lifecycle

  `AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LifecycleMBeanBase()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `destroyInternal()`
  Subclasses implement this method to perform any instance destruction required.
  `final String`
  `getDomain()`
  `protected abstract String`
  `getDomainInternal()`
  Method implemented by subclasses to identify the domain in which MBeans should be registered.
  `final ObjectName`
  `getObjectName()`
  `protected abstract String`
  `getObjectNameKeyProperties()`
  Allow subclasses to specify the key properties component of the `ObjectName` that will be used to register this component.
  `protected void`
  `initInternal()`
  Subclasses implement this method to perform any instance initialisation required.
  `final void`
  `postDeregister()`
  Not used - NOOP.
  `final void`
  `postRegister(Boolean registrationDone)`
  Not used - NOOP.
  `final void`
  `preDeregister()`
  Not used - NOOP.
  `final ObjectName`
  `preRegister(MBeanServer server, ObjectName name)`
  `protected final ObjectName`
  `register(Object obj, String objectNameKeyProperties)`
  Utility method to enable subclasses to easily register additional components that don't implement `JmxEnabled` with an MBean server.
  `final void`
  `setDomain(String domain)`
  Specify the domain under which this component should be registered.
  `protected final void`
  `unregister(String objectNameKeyProperties)`
  Utility method to enable subclasses to easily unregister additional components that don't implement `JmxEnabled` with an MBean server.
  `protected final void`
  `unregister(ObjectName on)`
  Utility method to enable subclasses to easily unregister additional components that don't implement `JmxEnabled` with an MBean server.

  ### Methods inherited from class LifecycleBase

  `addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, startInternal, stop, stopInternal`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### mserver

    @Deprecated protected MBeanServer mserver
    Deprecated.

- ## Constructor Details

  - ### LifecycleMBeanBase

    public LifecycleMBeanBase()

- ## Method Details

  - ### initInternal

    protected void initInternal() throws LifecycleException
    Description copied from class: `LifecycleBase`
    Subclasses implement this method to perform any instance initialisation required.
    Specified by:
      `initInternal` in class `LifecycleBase`
    Throws:
      `LifecycleException` - If the initialisation fails

  - ### destroyInternal

    protected void destroyInternal() throws LifecycleException
    Description copied from class: `LifecycleBase`
    Subclasses implement this method to perform any instance destruction required.
    Specified by:
      `destroyInternal` in class `LifecycleBase`
    Throws:
      `LifecycleException` - If the destruction fails

  - ### setDomain

    public final void setDomain(String domain)
    Description copied from interface: `JmxEnabled`
    Specify the domain under which this component should be registered. Used with components that cannot (easily) navigate the component hierarchy to determine the correct domain to use.
    Specified by:
      `setDomain` in interface `JmxEnabled`
    Parameters:
      `domain` - The name of the domain under which this component should be registered

  - ### getDomain

    public final String getDomain()
    Specified by:
      `getDomain` in interface `JmxEnabled`
    Returns:
      the domain under which this component will be / has been registered.

  - ### getDomainInternal

    protected abstract String getDomainInternal()
    Method implemented by subclasses to identify the domain in which MBeans should be registered.
    Returns:
      The name of the domain to use to register MBeans.

  - ### getObjectName

    public final ObjectName getObjectName()
    Specified by:
      `getObjectName` in interface `JmxEnabled`
    Returns:
      the name under which this component has been registered with JMX.

  - ### getObjectNameKeyProperties

    protected abstract String getObjectNameKeyProperties()
    Allow subclasses to specify the key properties component of the `ObjectName` that will be used to register this component.
    Returns:
      The string representation of the key properties component of the desired `ObjectName`

  - ### register

    protected final ObjectName register(Object obj, String objectNameKeyProperties)
    Utility method to enable subclasses to easily register additional components that don't implement `JmxEnabled` with an MBean server.
    Note: This method should only be used once `initInternal()` has been called and before `destroyInternal()` has been called.
    Parameters:
      `obj` - The object the register
      `objectNameKeyProperties` - The key properties component of the object name to use to register the object
    Returns:
      The name used to register the object

  - ### unregister

    protected final void unregister(String objectNameKeyProperties)
    Utility method to enable subclasses to easily unregister additional components that don't implement `JmxEnabled` with an MBean server.
    Note: This method should only be used once `initInternal()` has been called and before `destroyInternal()` has been called.
    Parameters:
      `objectNameKeyProperties` - The key properties component of the object name to use to unregister the object

  - ### unregister

    protected final void unregister(ObjectName on)
    Utility method to enable subclasses to easily unregister additional components that don't implement `JmxEnabled` with an MBean server.
    Note: This method should only be used once `initInternal()` has been called and before `destroyInternal()` has been called.
    Parameters:
      `on` - The name of the component to unregister

  - ### postDeregister

    public final void postDeregister()
    Not used - NOOP.
    Specified by:
      `postDeregister` in interface `MBeanRegistration`

  - ### postRegister

    public final void postRegister(Boolean registrationDone)
    Not used - NOOP.
    Specified by:
      `postRegister` in interface `MBeanRegistration`

  - ### preDeregister

    public final void preDeregister() throws Exception
    Not used - NOOP.
    Specified by:
      `preDeregister` in interface `MBeanRegistration`
    Throws:
      `Exception`

  - ### preRegister

    public final ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
    Specified by:
      `preRegister` in interface `MBeanRegistration`
    Throws:
      `Exception`