Package psiprobe.beans
Class ContainerListenerBean
- java.lang.Object
-
- psiprobe.beans.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 Summary
Fields Modifier and Type Field Description private Set<String>
allowedOperation
The allowed operation.private ContainerWrapperBean
containerWrapper
Used to obtain requiredMBeanServer
instance.private List<ObjectName>
executorNames
The executor names.private static org.slf4j.Logger
logger
The Constant logger.private List<ThreadPoolObjectName>
poolNames
The pool names.
-
Constructor Summary
Constructors Constructor Description ContainerListenerBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ThreadPoolObjectName
findPool(String name)
Finds ThreadPoolObjectName by its string name.List<Connector>
getConnectors(boolean includeRequestProcessors)
Gets the connectors.ContainerWrapperBean
getContainerWrapper()
Gets the container wrapper.List<ThreadPool>
getThreadPools()
Gets the thread pools.void
handleNotification(Notification notification, Object object)
Handles creation and deletion of new "worker" threads.private void
initialize()
Load ObjectNames for the relevant MBeans so they can be queried at a later stage without searching MBean server over and over again.private boolean
isInitialized()
Checks if is initialized.void
setContainerWrapper(ContainerWrapperBean containerWrapper)
Sets the container wrapper.void
toggleConnectorStatus(String operation, String port)
Toggle connector status.
-
-
-
Field Detail
-
logger
private static final org.slf4j.Logger logger
The Constant logger.
-
poolNames
private List<ThreadPoolObjectName> poolNames
The pool names.
-
executorNames
private List<ObjectName> executorNames
The executor names.
-
containerWrapper
@Inject private ContainerWrapperBean containerWrapper
Used to obtain requiredMBeanServer
instance.
-
-
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 interfaceNotificationListener
- Parameters:
notification
- the notificationobject
- 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.
-
getThreadPools
public List<ThreadPool> getThreadPools() throws Exception
Gets the thread pools.- Returns:
- the thread pools
- Throws:
Exception
- the exception
-
toggleConnectorStatus
public void toggleConnectorStatus(String operation, String port) throws Exception
Toggle connector status.- Parameters:
operation
- the operationport
- the port- Throws:
Exception
- the exception
-
-