Class DefaultStatisticsData

java.lang.Object
de.hybris.platform.servicelayer.stats.DefaultStatisticsData
All Implemented Interfaces:
StatisticsData

public class DefaultStatisticsData extends Object implements StatisticsData
Class stores data collected by Collectors in a map.
  • Constructor Details

    • DefaultStatisticsData

      public DefaultStatisticsData()
  • Method Details

    • addDataCollector

      public boolean addDataCollector(String name)
      Description copied from interface: StatisticsData
      Method adds a new collector with key name.
      Specified by:
      addDataCollector in interface StatisticsData
      Parameters:
      name - The name of the collector.
      Returns:
      boolean True, if added successfully.
    • removeDataCollector

      public boolean removeDataCollector(String name)
      Description copied from interface: StatisticsData
      Removes a registered Data-Collector, defined by name.
      Specified by:
      removeDataCollector in interface StatisticsData
      Parameters:
      name - String The name, defining the collector to be removed.
      Returns:
      boolean Indicating if Data-Collector has been removed sucessfull.
    • containsDataCollector

      public boolean containsDataCollector(String name)
      Description copied from interface: StatisticsData
      Find out, whether the Data-Collector identified by name is registered.
      Specified by:
      containsDataCollector in interface StatisticsData
      Parameters:
      name - String The name identifying the Data-Collector.
      Returns:
      boolean Indicates if the Data-Collector with name is registered.
    • putData

      public boolean putData(String name, long timestamp, float value)
      Description copied from interface: StatisticsData
      Method for putting one collected dataset consisting of a timestamp and a value.
      Specified by:
      putData in interface StatisticsData
      Parameters:
      name - The name of the data that are collected.
      timestamp - The time when the value has been collected, as milliseconds passed since 01.01.1970.
      value - The value that has been collected at specified time.
    • printStats

      protected void printStats(String name)
    • balanceDataLevels

      public void balanceDataLevels(String name)
      Description copied from interface: StatisticsData
      Method checks, if ticks held in different levels still observe the defined borders. If one Level contains data that must not be held by this level, the data is transfered into the next level, or regarding third level, dumped. This method should be called when the data-collector returns a value that does not need to be stored, to make sure that even if there are no new ticks added to the map, the contained data does not antiquate.
      Specified by:
      balanceDataLevels in interface StatisticsData
      Parameters:
      name - The name of the Collector that should be balanced.
    • trimAndAggregate

      protected void trimAndAggregate(NavigableMap<Long,Float> fromMap, NavigableMap<Long,Float> toMap, long now, long millisToKeep, int ticksToRemoveAtOnce)
    • getTimePeriodData

      public Object[][] getTimePeriodData(String name, long start, long end, long utcOffset)
      Description copied from interface: StatisticsData
      Get the data of a speciific period of time from start till end.
      Specified by:
      getTimePeriodData in interface StatisticsData
      Parameters:
      name - The name of the data you want to get.
      start - The start-timestamp for the data.
      end - The end-timestamp for the data.
      utcOffset - The difference between local client time and UTC-time (server time) in ms.
      Returns:
      Map<Long, Float>, containing the data during the given time period.
    • getAllData

      public Object[][] getAllData(String name, int maxTicks, long utcOffset)
      Description copied from interface: StatisticsData
      Get all available data of the Data-Collector defined by name.
      Specified by:
      getAllData in interface StatisticsData
      Parameters:
      name - String The name defining the Data-Collector you want to get the Data from.
      maxTicks - The maximum number of ticks that will be returned.
      utcOffset - The difference between local client time and UTC-time (server time) in ms.
      Returns:
      Map<Long, Float> The Map containing all Key-Value pairs of the Data-Collector with name name.
    • getTickAsArray

      public Object[][] getTickAsArray(String name, long period, int maxTicks, long utcOffset)
      Description copied from interface: StatisticsData
      Get time-period of length period in ms from Collector name as Object Array.
      Specified by:
      getTickAsArray in interface StatisticsData
      Parameters:
      name - The name identifying the DataCollector, which data is returned.
      period - Defines how long into past the time period should reach from now.
      maxTicks - Specifies the maximum number of Ticks that should be returned.
      utcOffset - The difference between local client time and UTC-time (server time) in ms.
      Returns:
      The Object[][] containing the x- and y-value for drawing a diagram.
    • getCurrentSize

      public int getCurrentSize(String name)
      Description copied from interface: StatisticsData
      Get the current size of the data-collector called name.
      Specified by:
      getCurrentSize in interface StatisticsData
      Returns:
      The current size of the stored data for collector called name.
    • getLevelSizes

      public int[] getLevelSizes(String name)
      Returns the tick-amount in the different level-sizes as int-Array.
      Parameters:
      name - The name of the Collector, the level-sizes should be returned for.
      Returns:
      Array containing the amount of ticks stored in the different levels.
    • setSizeLvl1Ms

      public void setSizeLvl1Ms(long ms)
      Setter for the time-period ticks are stored in level-1.
    • setSizeLvl2Ms

      public void setSizeLvl2Ms(long ms)
      Setter for the time-period, ticks are stored in level-2.
    • setSizeLvl3Ms

      public void setSizeLvl3Ms(long ms)
      Setter for the time-period, ticks are stored in level-3.
    • getCollectorValue

      public float getCollectorValue(String name, long timestamp)
      Description copied from interface: StatisticsData
      Get one value of the collector called name at the given timestamp.
      Specified by:
      getCollectorValue in interface StatisticsData
      Parameters:
      name - The name of the collector.
      timestamp - The timestamp you want to have the value of.
      Returns:
      The value of the collector at the given timestamp. -1 if no such collector or timestamp available.