Class FileMonitoringTimerTask

  • All Implemented Interfaces:
    MonitoringTimerTaskMBean, Runnable

    public class FileMonitoringTimerTask
    extends MonitoringTimerTask
    The FileMonitoringTimerTask class allows to periodically watch JMX attributes and store the corresponding values to a file in CSV format.
    • 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 java launching command, or in a3servers.xml configuration 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 is 60000L (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 java launching command, or in a3servers.xml configuration 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 is fileMonitoring.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 java launching command, or in a3servers.xml configuration 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 is monitoringStats.csv.
        See Also:
        FileMonitoringTimerTask, Constant Field Values
      • path

        public String path
        Pathname of the result file.
    • Constructor Detail

      • FileMonitoringTimerTask

        public FileMonitoringTimerTask​(Timer timer,
                                       long period,
                                       Properties attlist,
                                       String path)
        Initializes the FileMonitoringTimerTask component.
        Parameters:
        timer - Timer to use to schedule the resulting task.
        period - Period value of the resulting task
        attlist - List of JMX attributes to periodically watch.
        path - Pathname of resulting CSV file.
      • FileMonitoringTimerTask

        public FileMonitoringTimerTask()
        Instantiates the FileMonitoringTimerTask component.
    • Method Detail

      • init

        public void init​(Timer timer,
                         long period,
                         Properties attlist,
                         Properties taskProps)
        Initializes the FileMonitoringTimerTask component.
        Specified by:
        init in class MonitoringTimerTask
        Parameters:
        timer - The timer to use to schedule the resulting task.
        period - Period value of the resulting task
        attlist - List of JMX attributes to periodically watch.
        taskProps - The properties to initialize the task.
      • addRecord

        protected void addRecord​(String mbean,
                                 String att,
                                 Object value)
        Records information about the specified attribute.
        Specified by:
        addRecord in class MonitoringTimerTask
        Parameters:
        mbean - The name of the related mbean.
        att - The name of the related attribute.
        value - The value of the related attribute.
      • close

        public void close()
        Close the result file, be careful you have to call this method only if the monitoring task is stopped.