Class BaseStatsHandler

java.lang.Object
org.jppf.ui.monitoring.data.BaseStatsHandler
Direct Known Subclasses:
StatsHandler

public class BaseStatsHandler extends Object
This class provides a convenient access to the statistics obtained from the JPPF server.
Author:
Laurent Cohen
  • Field Details

    • refreshInterval

      protected long refreshInterval
      Interval, in milliseconds, between refreshes from the server.
    • rolloverPosition

      protected final int rolloverPosition
      Number of data snapshots kept in memory.
    • dataHolderMap

      protected final Map<String,ConnectionDataHolder> dataHolderMap
      Contains all the data and its converted values received from the server.
  • Constructor Details

    • BaseStatsHandler

      public BaseStatsHandler()
      Initialize this statistics handler.
  • Method Details

    • getRefreshInterval

      public long getRefreshInterval()
      Get the interval between refreshes from the server.
      Returns:
      the interval in milliseconds.
    • setRefreshInterval

      public void setRefreshInterval(long refreshInterval)
      Set the interval between refreshes from the server.
      Parameters:
      refreshInterval - the interval in milliseconds.
    • requestUpdate

      public org.jppf.utils.stats.JPPFStatistics requestUpdate(org.jppf.client.monitoring.topology.TopologyDriver driver)
      Request an update from the server.
      Parameters:
      driver - represents the client connection to request the data from.
      Returns:
      a JPPFStatistics object.
    • update

      public void update(org.jppf.client.monitoring.topology.TopologyDriver driver, org.jppf.utils.stats.JPPFStatistics stats)
      Update the current statistics with new values obtained from the server.
      Parameters:
      driver - represents the client connection from which the data is obtained.
      stats - the object holding the new statistics values.
    • getRolloverPosition

      public int getRolloverPosition()
      Get the number of data snapshots kept in memory.
      Returns:
      the rollover position as an int value.
    • getStatsCount

      public int getStatsCount(org.jppf.client.monitoring.topology.TopologyDriver driver)
      Get the current number of data snapshots for the specified driver.
      Parameters:
      driver - the driver for which to get the information.
      Returns:
      the number of snapshots as an int.
    • getStringValues

      public Map<Fields,String> getStringValues(Locale locale, org.jppf.client.monitoring.topology.TopologyDriver driver, int position)
      Get the mapping of a data snapshot's fields, at a specified position, to their corresponding string values.
      Parameters:
      locale - the locale to use for values formatting.
      driver - the driver for which to get the information.
      position - the position to get the data at.
      Returns:
      a map of field names to their values represented as strings.
    • getLatestStringValues

      public Map<Fields,String> getLatestStringValues(Locale locale, org.jppf.client.monitoring.topology.TopologyDriver driver)
      Get the mapping of the most recent data snapshot's fields to their corresponding string values.
      Parameters:
      locale - the locale to use for values formatting.
      driver - the driver for which to get the information.
      Returns:
      a map of field names to their values represented as strings.
    • formatLatestValue

      public String formatLatestValue(Locale locale, org.jppf.client.monitoring.topology.TopologyDriver driver, Fields field)
      Format the value of the specified field according tot he specified locale.
      Parameters:
      locale - the locale in which to format.
      driver - the driver to add.
      field - the field whose value is to be formatted.
      Returns:
      value formatted accoridng to the locale.
    • getDoubleValues

      public Map<Fields,Double> getDoubleValues(org.jppf.client.monitoring.topology.TopologyDriver driver, int position)
      Get the mapping of a data snapshot's fields, at a specified position, to their corresponding double values.
      Parameters:
      driver - the driver for which to get the information.
      position - the position to get the data at.
      Returns:
      a map of field names to their values represented as double values.
    • getLatestDoubleValues

      public Map<Fields,Double> getLatestDoubleValues(org.jppf.client.monitoring.topology.TopologyDriver driver)
      Get the mapping of the most recent data snapshot's fields to their corresponding double values.
      Parameters:
      driver - the driver for which to get the information.
      Returns:
      a map of field names to their values represented as double values.
    • addStatsHandlerListener

      public void addStatsHandlerListener(StatsHandlerListener listener)
      Register a StatsHandlerListener with this stats formatter.
      Parameters:
      listener - the listener to register.
    • removeStatsHandlerListener

      public void removeStatsHandlerListener(StatsHandlerListener listener)
      Unregister a StatsHandlerListener from this stats formatter.
      Parameters:
      listener - the listener to unregister.
    • fireStatsHandlerEvent

      public void fireStatsHandlerEvent(StatsHandlerEvent.Type type)
      Notify all listeners of a change in this stats formatter.
      Parameters:
      type - the type of event to fire.
    • getTickCount

      public int getTickCount()
      Get the number of data updates so far.
      Returns:
      the number of updates as an int.
    • getFormatter

      protected StatsFormatter getFormatter(Locale locale)
      Get, and create if needed, the formatter for the specified locale.
      Parameters:
      locale - the locale to use for values formatting.
      Returns:
      a StatsFormatter instance.
    • getShowIPHandler

      public ShowIPHandler getShowIPHandler()
      Returns:
      the object that handles the toggle for showing host names vs. IP addresses.