Kieker 1.9

kieker.monitoring.probe.servlet
Class CPUsCombinedServletContextListener

java.lang.Object
  extended by kieker.monitoring.probe.servlet.CPUsCombinedServletContextListener
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener

public class CPUsCombinedServletContextListener
extends Object
implements javax.servlet.ServletContextListener

Starts and stops the periodic logging of CPU utilization employing the SigarSamplerFactory as the Servlet is initialized and destroyed respectively.
The initial delay and the sampling period (both given in seconds) can be configured via context-params in the web.xml file, as shown below.

The integration and configuration in a web.xml file works as follows:

 <web-app>
  ...
  
 <context-param>
  <param-name>CPUsCombinedServletContextListener.samplingIntervalSeconds</param-name>
  <param-value>15</param-value>
 </context-param>
 
  <context-param>
   <param-name>CPUsCombinedServletContextListener.initialSamplingDelaySeconds</param-name>
  <param-value>0</param-value>
 </context-param>
 
 <listener>
   <listener-class>
     kieker.monitoring.probe.servlet.CPUsCombinedServletContextListener
   </listener-class>
 </listener>
 
 ... 
 </web-app>
 }
 

Since:
1.3
Author:
Andre van Hoorn

Field Summary
static String CONTEXT_PARAM_NAME_INITIAL_SAMPLING_DELAY_SECONDS
          Parameter name for the initial delay to be used in the web.xml file.
static String CONTEXT_PARAM_NAME_SAMPLING_INTERVAL_SECONDS
          Parameter name for the sampling interval to be used in the web.xml file.
static long DEFAULT_SENSOR_INITIAL_DELAY_SECONDS
          The default used initial delay in seconds.
static long DEFAULT_SENSOR_INTERVAL_SECONDS
          The default used sensor interval in seconds.
 
Constructor Summary
CPUsCombinedServletContextListener()
          Creates a new instance of this class.
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent sce)
          
 void contextInitialized(javax.servlet.ServletContextEvent sce)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SENSOR_INTERVAL_SECONDS

public static final long DEFAULT_SENSOR_INTERVAL_SECONDS
The default used sensor interval in seconds.

See Also:
Constant Field Values

DEFAULT_SENSOR_INITIAL_DELAY_SECONDS

public static final long DEFAULT_SENSOR_INITIAL_DELAY_SECONDS
The default used initial delay in seconds.

See Also:
Constant Field Values

CONTEXT_PARAM_NAME_SAMPLING_INTERVAL_SECONDS

public static final String CONTEXT_PARAM_NAME_SAMPLING_INTERVAL_SECONDS
Parameter name for the sampling interval to be used in the web.xml file.


CONTEXT_PARAM_NAME_INITIAL_SAMPLING_DELAY_SECONDS

public static final String CONTEXT_PARAM_NAME_INITIAL_SAMPLING_DELAY_SECONDS
Parameter name for the initial delay to be used in the web.xml file.

Constructor Detail

CPUsCombinedServletContextListener

public CPUsCombinedServletContextListener()
Creates a new instance of this class.

Method Detail

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent sce)

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent sce)

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener

Kieker 1.9

Copyright 2014 Kieker Project, http://kieker-monitoring.net