Class ContainerListenerBean

  • All Implemented Interfaces:
    EventListener, NotificationListener

    public class ContainerListenerBean
    extends Object
    implements NotificationListener
    This class interfaces Tomcat JMX functionality to read connection status. The class essentially provides and maintains the list of connection ThreadPools.
    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
        The Constant logger.
      • allowedOperation

        private Set<String> allowedOperation
        The allowed operation.
      • executorNames

        private List<ObjectName> executorNames
        The executor names.
    • Constructor Detail

      • ContainerListenerBean

        public ContainerListenerBean()
    • Method Detail

      • getContainerWrapper

        public ContainerWrapperBean getContainerWrapper()
        Gets the container wrapper.
        Returns:
        the container wrapper
      • setContainerWrapper

        public void setContainerWrapper​(ContainerWrapperBean containerWrapper)
        Sets the container wrapper.
        Parameters:
        containerWrapper - the new container wrapper
      • isInitialized

        private boolean isInitialized()
        Checks if is initialized.
        Returns:
        true, if is initialized
      • findPool

        private ThreadPoolObjectName findPool​(String name)
        Finds ThreadPoolObjectName by its string name.
        Parameters:
        name - - pool name
        Returns:
        null if the input name is null or ThreadPoolObjectName is not found
      • handleNotification

        public void handleNotification​(Notification notification,
                                       Object object)
        Handles creation and deletion of new "worker" threads.
        Specified by:
        handleNotification in interface NotificationListener
        Parameters:
        notification - the notification
        object - the object
      • initialize

        private void initialize()
                         throws Exception
        Load ObjectNames for the relevant MBeans so they can be queried at a later stage without searching MBean server over and over again.
        Throws:
        Exception - - this method does not handle any of the exceptions that may be thrown when querying MBean server.
      • toggleConnectorStatus

        public void toggleConnectorStatus​(String operation,
                                          String port)
                                   throws Exception
        Toggle connector status.
        Parameters:
        operation - the operation
        port - the port
        Throws:
        Exception - the exception
      • getConnectors

        public List<Connector> getConnectors​(boolean includeRequestProcessors)
                                      throws Exception
        Gets the connectors.
        Parameters:
        includeRequestProcessors - the include request processors
        Returns:
        the connectors
        Throws:
        Exception - the exception