public class RequestCountListener extends Object implements javax.servlet.ServletRequestListener
Modifier and Type | Field and Description |
---|---|
private static boolean |
_active |
private static AtomicInteger |
_current |
private static Logger |
_logger |
private static AtomicInteger |
_total |
Constructor and Description |
---|
RequestCountListener()
Activate the counter
|
Modifier and Type | Method and Description |
---|---|
static int |
getCurrentRequestCount()
Returns the current number of active requests.
|
static int |
getTotalRequestCount()
Returns the total number of requests since startup.
|
void |
requestDestroyed(javax.servlet.ServletRequestEvent event) |
void |
requestInitialized(javax.servlet.ServletRequestEvent event) |
private static AtomicInteger _current
private static AtomicInteger _total
private static boolean _active
public RequestCountListener()
public void requestInitialized(javax.servlet.ServletRequestEvent event)
requestInitialized
in interface javax.servlet.ServletRequestListener
public void requestDestroyed(javax.servlet.ServletRequestEvent event)
requestDestroyed
in interface javax.servlet.ServletRequestListener
public static int getCurrentRequestCount()
IllegalStateException
- if the listener is not registered.public static int getTotalRequestCount()
IllegalStateException
- if the listener is not registered.