Package fr.dyade.aaa.common.monitoring
Class FileMonitoringTimerTask
- java.lang.Object
-
- java.util.TimerTask
-
- fr.dyade.aaa.common.monitoring.MonitoringTimerTask
-
- fr.dyade.aaa.common.monitoring.FileMonitoringTimerTask
-
- All Implemented Interfaces:
MonitoringTimerTaskMBean,Runnable
public class FileMonitoringTimerTask extends MonitoringTimerTask
TheFileMonitoringTimerTaskclass allows to periodically watch JMX attributes and store the corresponding values to a file in CSV format.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_MONITORING_CONFIG_PATHDefault value for the pathname of a configuration file for a csv file monitoring task in the server, value isfileMonitoring.props.static longDEFAULT_MONITORING_CONFIG_PERIODDefault value for the scanning period for the csv file monitoring task in the server, value is60000L(60 seconds).static StringDEFAULT_MONITORING_RESULT_PATHDefault value for the pathname of the results file for the monitoring task in the server, value ismonitoringStats.csv.static StringMONITORING_CONFIG_PATH_PROPERTYName of property allowing to fix the pathname of a configuration file for a csv file monitoring task in the server.static StringMONITORING_CONFIG_PERIOD_PROPERTYName of property allowing to fix the scanning period for the csv file monitoring task in the server.static StringMONITORING_RESULT_PATH_PROPERTYName of property allowing to fix the pathname of the results file for the csv file monitoring task in the server.StringpathPathname of the result file.(package private) StringBufferstrbuf(package private) Timertimer(package private) FileWriterwriter-
Fields inherited from class fr.dyade.aaa.common.monitoring.MonitoringTimerTask
attlist, logger, mbeanName, timerPeriod
-
-
Constructor Summary
Constructors Constructor Description FileMonitoringTimerTask()Instantiates theFileMonitoringTimerTaskcomponent.FileMonitoringTimerTask(Timer timer, long period, Properties attlist, String path)Initializes theFileMonitoringTimerTaskcomponent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddRecord(String mbean, String att, Object value)Records information about the specified attribute.voidclose()Close the result file, be careful you have to call this method only if the monitoring task is stopped.protected voidfinalizeRecords()Finalize the record for the current time.voidinit(Timer timer, long period, Properties attlist, Properties taskProps)Initializes theFileMonitoringTimerTaskcomponent.protected voidinitializeRecords()Initialize the record for the current collect time.-
Methods inherited from class fr.dyade.aaa.common.monitoring.MonitoringTimerTask
addMonitoredAttributes, cancelTask, delMonitoredAttributes, getMonitoredAttributes, getPeriod, run, start
-
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
-
-
-
Field Detail
-
MONITORING_CONFIG_PERIOD_PROPERTY
public static final String MONITORING_CONFIG_PERIOD_PROPERTY
Name of property allowing to fix the scanning period for the csv file monitoring task in the server.This property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.- See Also:
FileMonitoringTimerTask, Constant Field Values
-
DEFAULT_MONITORING_CONFIG_PERIOD
public static final long DEFAULT_MONITORING_CONFIG_PERIOD
Default value for the scanning period for the csv file monitoring task in the server, value is60000L(60 seconds).- See Also:
FileMonitoringTimerTask, Constant Field Values
-
MONITORING_CONFIG_PATH_PROPERTY
public static final String MONITORING_CONFIG_PATH_PROPERTY
Name of property allowing to fix the pathname of a configuration file for a csv file monitoring task in the server.This property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.- See Also:
FileMonitoringTimerTask, Constant Field Values
-
DEFAULT_MONITORING_CONFIG_PATH
public static final String DEFAULT_MONITORING_CONFIG_PATH
Default value for the pathname of a configuration file for a csv file monitoring task in the server, value isfileMonitoring.props.If the file does not exist the timer task is not launched.
- See Also:
FileMonitoringTimerTask, Constant Field Values
-
MONITORING_RESULT_PATH_PROPERTY
public static final String MONITORING_RESULT_PATH_PROPERTY
Name of property allowing to fix the pathname of the results file for the csv file monitoring task in the server.This property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.- See Also:
FileMonitoringTimerTask, Constant Field Values
-
DEFAULT_MONITORING_RESULT_PATH
public static final String DEFAULT_MONITORING_RESULT_PATH
Default value for the pathname of the results file for the monitoring task in the server, value ismonitoringStats.csv.- See Also:
FileMonitoringTimerTask, Constant Field Values
-
writer
FileWriter writer
-
strbuf
StringBuffer strbuf
-
timer
Timer timer
-
path
public String path
Pathname of the result file.
-
-
Constructor Detail
-
FileMonitoringTimerTask
public FileMonitoringTimerTask(Timer timer, long period, Properties attlist, String path)
Initializes theFileMonitoringTimerTaskcomponent.- Parameters:
timer- Timer to use to schedule the resulting task.period- Period value of the resulting taskattlist- List of JMX attributes to periodically watch.path- Pathname of resulting CSV file.
-
FileMonitoringTimerTask
public FileMonitoringTimerTask()
Instantiates theFileMonitoringTimerTaskcomponent.
-
-
Method Detail
-
init
public void init(Timer timer, long period, Properties attlist, Properties taskProps)
Initializes theFileMonitoringTimerTaskcomponent.- Specified by:
initin classMonitoringTimerTask- 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.
-
initializeRecords
protected void initializeRecords()
Initialize the record for the current collect time. For the FileMonitoringTimer, it consists to initialize a StringBuffer to collect informations about all attributes.- Specified by:
initializeRecordsin classMonitoringTimerTask- See Also:
MonitoringTimerTask.initializeRecords()
-
addRecord
protected void addRecord(String mbean, String att, Object value)
Records information about the specified attribute.- Specified by:
addRecordin classMonitoringTimerTask- Parameters:
mbean- The name of the related mbean.att- The name of the related attribute.value- The value of the related attribute.
-
finalizeRecords
protected void finalizeRecords()
Finalize the record for the current time.- Specified by:
finalizeRecordsin classMonitoringTimerTask- See Also:
MonitoringTimerTask.finalizeRecords()
-
close
public void close()
Close the result file, be careful you have to call this method only if the monitoring task is stopped.
-
-