GlobalResourcesLifecycleListener (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.catalina.mbeans, class: GlobalResourcesLifecycleListener

# Class GlobalResourcesLifecycleListener

java.lang.Object
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener

All Implemented Interfaces:
  `LifecycleListener`

public class GlobalResourcesLifecycleListener extends Object implements LifecycleListener
Implementation of `LifecycleListener` that instantiates the set of MBeans associated with global JNDI resources that are subject to management.

This listener must only be nested within `Server` elements.

Since:
  4.1

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Lifecycle`
  `component`
  The owning Catalina component that we are attached to.
  `protected static final StringManager`
  `sm`
  StringManager for this class.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GlobalResourcesLifecycleListener()`
  Default constructor for GlobalResourcesLifecycleListener.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `createMBeans()`
  Create the MBeans for the interesting global JNDI resources.
  `protected void`
  `createMBeans(String prefix, Context context)`
  Create the MBeans for the interesting global JNDI resources in the specified naming context.
  `protected void`
  `createMBeans(String name, UserDatabase database)`
  Create the MBeans for the specified UserDatabase and its contents.
  `protected void`
  `destroyMBeans()`
  Destroy the MBeans for the interesting global JNDI resources.
  `void`
  `lifecycleEvent(LifecycleEvent event)`
  Primary entry point for startup and shutdown events.

  ### Methods inherited from class Object

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

- ## Field Details

  - ### sm

    protected static final StringManager sm
    StringManager for this class.

  - ### component

    protected Lifecycle component
    The owning Catalina component that we are attached to.

- ## Constructor Details

  - ### GlobalResourcesLifecycleListener

    public GlobalResourcesLifecycleListener()
    Default constructor for GlobalResourcesLifecycleListener.

- ## Method Details

  - ### lifecycleEvent

    public void lifecycleEvent(LifecycleEvent event)
    Primary entry point for startup and shutdown events.
    Specified by:
      `lifecycleEvent` in interface `LifecycleListener`
    Parameters:
      `event` - The event that has occurred

  - ### createMBeans

    protected void createMBeans()
    Create the MBeans for the interesting global JNDI resources.

  - ### createMBeans

    protected void createMBeans(String prefix, Context context) throws NamingException
    Create the MBeans for the interesting global JNDI resources in the specified naming context.
    Parameters:
      `prefix` - Prefix for complete object name paths
      `context` - Context to be scanned
    Throws:
      `NamingException` - if a JNDI exception occurs

  - ### createMBeans

    protected void createMBeans(String name, UserDatabase database) throws Exception
    Create the MBeans for the specified UserDatabase and its contents.
    Parameters:
      `name` - Complete resource name of this UserDatabase
      `database` - The UserDatabase to be processed
    Throws:
      `Exception` - if an exception occurs while creating MBeans

  - ### destroyMBeans

    protected void destroyMBeans()
    Destroy the MBeans for the interesting global JNDI resources.