fr.dyade.aaa.common.monitoring
Class MonitoringTimerTask

java.lang.Object
  extended by java.util.TimerTask
      extended by fr.dyade.aaa.common.monitoring.MonitoringTimerTask
All Implemented Interfaces:
MonitoringTimerTaskMBean, java.lang.Runnable
Direct Known Subclasses:
FileMonitoringTimerTask, LogMonitoringTimerTask

public abstract class MonitoringTimerTask
extends java.util.TimerTask
implements MonitoringTimerTaskMBean

The MonitoringTimerTask class allows to periodically watch JMX attributes and store the corresponding values to various support.


Field Summary
static org.objectweb.util.monolog.api.Logger logger
           
protected  long period
          Time between two monitoring events
 
Constructor Summary
MonitoringTimerTask(long period, java.util.Properties attlist)
          Initializes the MonitoringTimerTask component.
 
Method Summary
 void addMonitoredAttributes(java.lang.String MBeanName, java.lang.String attributes)
          Add the specified attributes to the list of monitored attributes.
protected abstract  void addRecord(javax.management.ObjectName mbean, java.lang.String att, java.lang.Object value)
          Records information about the specified attribute.
 void cancelTask()
          Cancels this timer task.
 void delMonitoredAttributes(java.lang.String MBeanName)
          Removes all the attributes of the specified MBean in the list of monitored attributes.
protected abstract  void finalizeRecords()
          Finalize the record for the current time.
 java.lang.String[] getMonitoredAttributes()
          Returns the comma separated list of all monitored attributes.
 long getPeriod()
          Returns the period value of this task, -1 if not set.
protected abstract  void initializeRecords()
          Initialize the record for the current collect time.
 void run()
          When the task is waken up, collect the monitoring information required and saves it.
protected  void start(java.util.Timer timer)
          Starts the resulting task.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

period

protected long period
Time between two monitoring events


logger

public static org.objectweb.util.monolog.api.Logger logger
Constructor Detail

MonitoringTimerTask

public MonitoringTimerTask(long period,
                           java.util.Properties attlist)
Initializes the MonitoringTimerTask component.

Parameters:
period - Period value of the resulting task
attlist - List of JMX attributes to periodically watch.
Method Detail

getPeriod

public long getPeriod()
Returns the period value of this task, -1 if not set.

Specified by:
getPeriod in interface MonitoringTimerTaskMBean
Returns:
the period value of this task; -1 if not set.

start

protected final void start(java.util.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(javax.management.ObjectName mbean,
                                  java.lang.String att,
                                  java.lang.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.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask
See Also:
fr.dyade.aaa.common.TimerTask#run()

getMonitoredAttributes

public java.lang.String[] getMonitoredAttributes()
Returns the comma separated list of all monitored attributes.

Specified by:
getMonitoredAttributes in interface MonitoringTimerTaskMBean
Returns:
the comma separated list of all monitored attributes.

addMonitoredAttributes

public void addMonitoredAttributes(java.lang.String MBeanName,
                                   java.lang.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:
addMonitoredAttributes in interface MonitoringTimerTaskMBean
Parameters:
MBeanName - the name of the MBean.
attributes - the comma separated list of attributes to monitor.

delMonitoredAttributes

public void delMonitoredAttributes(java.lang.String MBeanName)
Removes all the attributes of the specified MBean in the list of monitored attributes.

Specified by:
delMonitoredAttributes in interface MonitoringTimerTaskMBean
Parameters:
MBeanName - the name of the MBean.

cancelTask

public void cancelTask()
Cancels this timer task.

Specified by:
cancelTask in interface MonitoringTimerTaskMBean


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.