Package fr.dyade.aaa.common.monitoring
Class MonitoringTimerTask
- java.lang.Object
-
- java.util.TimerTask
-
- fr.dyade.aaa.common.monitoring.MonitoringTimerTask
-
- All Implemented Interfaces:
MonitoringTimerTaskMBean,Runnable
- Direct Known Subclasses:
FileMonitoringTimerTask,LogMonitoringTimerTask,WindowMonitoringTimerTask
public abstract class MonitoringTimerTask extends TimerTask implements MonitoringTimerTaskMBean
TheMonitoringTimerTaskclass allows to periodically watch JMX attributes and store the corresponding values to various support.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Propertiesattliststatic LoggerloggerStringmbeanNameName use to register/unregister MBeanprotected longtimerPeriodTime between two monitoring events
-
Constructor Summary
Constructors Constructor Description MonitoringTimerTask()Creates aMonitoringTimerTaskcomponent.MonitoringTimerTask(long period, Properties attlist)Creates aMonitoringTimerTaskcomponent.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddMonitoredAttributes(String MBeanName, String attributes)Add the specified attributes to the list of monitored attributes.protected abstract voidaddRecord(String mbean, String att, Object value)Records information about the specified attribute.voidcancelTask()Cancels this timer task.voiddelMonitoredAttributes(String MBeanName)Removes all the attributes of the specified MBean in the list of monitored attributes.protected abstract voidfinalizeRecords()Finalize the record for the current time.String[]getMonitoredAttributes()Returns the comma separated list of all monitored attributes.longgetPeriod()Returns the period value of this task, -1 if not set.abstract voidinit(Timer timer, long period, Properties attlist, Properties taskProps)Initializes theMonitoringTimerTaskcomponent.protected abstract voidinitializeRecords()Initialize the record for the current collect time.voidrun()When the task is waken up, collect the monitoring information required and saves it (see method run of fr.dyade.aaa.common.TimerTask class).protected voidstart(Timer timer)Starts the resulting task.-
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
-
-
-
Field Detail
-
logger
public static final Logger logger
-
timerPeriod
protected long timerPeriod
Time between two monitoring events
-
attlist
Properties attlist
-
mbeanName
public String mbeanName
Name use to register/unregister MBean
-
-
Constructor Detail
-
MonitoringTimerTask
public MonitoringTimerTask(long period, Properties attlist)Creates aMonitoringTimerTaskcomponent.- Parameters:
period- Period value of the resulting taskattlist- List of JMX attributes to periodically watch.
-
MonitoringTimerTask
public MonitoringTimerTask()
Creates aMonitoringTimerTaskcomponent.
-
-
Method Detail
-
getPeriod
public long getPeriod()
Returns the period value of this task, -1 if not set.- Specified by:
getPeriodin interfaceMonitoringTimerTaskMBean- Returns:
- the period value of this task; -1 if not set.
-
init
public abstract void init(Timer timer, long period, Properties attlist, Properties taskProps)
Initializes theMonitoringTimerTaskcomponent.- Parameters:
timer- The timer to use to schedule the resulting task.period- Period value of the resulting taskattlist- List of JMX attributes to periodically watch.taskProps- The properties to initialize the task.
-
start
protected final void start(Timer timer)
Starts the resulting task.- Parameters:
timer- Timer to use to schedule the resulting task.
-
initializeRecords
protected abstract void initializeRecords()
Initialize the record for the current collect time.
-
addRecord
protected abstract void addRecord(String mbean, String att, Object value)
Records information about the specified attribute.- Parameters:
mbean- The name of the related mbean.att- The name of the related attribute.value- The value of the related attribute.
-
finalizeRecords
protected abstract void finalizeRecords()
Finalize the record for the current time.
-
run
public void run()
When the task is waken up, collect the monitoring information required and saves it (see method run of fr.dyade.aaa.common.TimerTask class).
-
getMonitoredAttributes
public String[] getMonitoredAttributes()
Returns the comma separated list of all monitored attributes.- Specified by:
getMonitoredAttributesin interfaceMonitoringTimerTaskMBean- Returns:
- the comma separated list of all monitored attributes.
-
addMonitoredAttributes
public void addMonitoredAttributes(String MBeanName, String attributes)
Add the specified attributes to the list of monitored attributes. If the Mbean is already monitored, the specified list of attributes overrides the existing one.- Specified by:
addMonitoredAttributesin interfaceMonitoringTimerTaskMBean- Parameters:
MBeanName- the name of the MBean.attributes- the comma separated list of attributes to monitor.
-
delMonitoredAttributes
public void delMonitoredAttributes(String MBeanName)
Removes all the attributes of the specified MBean in the list of monitored attributes.- Specified by:
delMonitoredAttributesin interfaceMonitoringTimerTaskMBean- Parameters:
MBeanName- the name of the MBean.
-
cancelTask
public void cancelTask()
Cancels this timer task.- Specified by:
cancelTaskin interfaceMonitoringTimerTaskMBean
-
-