Class RequestCountListener
- java.lang.Object
-
- org.ametys.runtime.plugins.admin.jvmstatus.RequestCountListener
-
- All Implemented Interfaces:
EventListener
,ServletRequestListener
public class RequestCountListener extends Object implements ServletRequestListener
This component count the current active requests and count all request since startup.
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
_active
private static AtomicInteger
_current
private static org.slf4j.Logger
_logger
private static AtomicInteger
_total
-
Constructor Summary
Constructors Constructor Description RequestCountListener()
Activate the counter
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
getCurrentRequestCount()
Returns the current number of active requests.static int
getTotalRequestCount()
Returns the total number of requests since startup.void
requestDestroyed(ServletRequestEvent event)
void
requestInitialized(ServletRequestEvent event)
-
-
-
Field Detail
-
_current
private static AtomicInteger _current
-
_total
private static AtomicInteger _total
-
_active
private static boolean _active
-
_logger
private static org.slf4j.Logger _logger
-
-
Constructor Detail
-
RequestCountListener
public RequestCountListener()
Activate the counter
-
-
Method Detail
-
requestInitialized
public void requestInitialized(ServletRequestEvent event)
- Specified by:
requestInitialized
in interfaceServletRequestListener
-
requestDestroyed
public void requestDestroyed(ServletRequestEvent event)
- Specified by:
requestDestroyed
in interfaceServletRequestListener
-
getCurrentRequestCount
public static int getCurrentRequestCount()
Returns the current number of active requests.- Returns:
- the current number of active requests.
- Throws:
IllegalStateException
- if the listener is not registered.
-
getTotalRequestCount
public static int getTotalRequestCount()
Returns the total number of requests since startup.- Returns:
- the total number of active since startup.
- Throws:
IllegalStateException
- if the listener is not registered.
-
-