Class ForwardingIOStatisticsStore

java.lang.Object
org.apache.hadoop.fs.statistics.impl.ForwardingIOStatisticsStore
All Implemented Interfaces:
DurationTrackerFactory, IOStatisticsStore, IOStatistics, IOStatisticsAggregator, IOStatisticsSetters

public class ForwardingIOStatisticsStore extends Object implements IOStatisticsStore
This may seem odd having an IOStatisticsStore which does nothing but forward to a wrapped store, but it's designed to assist in subclassing of selective methods, such as those to increment counters, get durations etc.
  • Constructor Details

    • ForwardingIOStatisticsStore

      public ForwardingIOStatisticsStore(IOStatisticsStore innerStatistics)
  • Method Details

    • getInnerStatistics

      protected IOStatisticsStore getInnerStatistics()
    • counters

      public Map<String,Long> counters()
      Description copied from interface: IOStatistics
      Map of counters.
      Specified by:
      counters in interface IOStatistics
      Returns:
      the current map of counters.
    • gauges

      public Map<String,Long> gauges()
      Description copied from interface: IOStatistics
      Map of gauges.
      Specified by:
      gauges in interface IOStatistics
      Returns:
      the current map of gauges.
    • minimums

      public Map<String,Long> minimums()
      Description copied from interface: IOStatistics
      Map of minimums.
      Specified by:
      minimums in interface IOStatistics
      Returns:
      the current map of minimums.
    • maximums

      public Map<String,Long> maximums()
      Description copied from interface: IOStatistics
      Map of maximums.
      Specified by:
      maximums in interface IOStatistics
      Returns:
      the current map of maximums.
    • meanStatistics

      public Map<String,MeanStatistic> meanStatistics()
      Description copied from interface: IOStatistics
      Map of meanStatistics.
      Specified by:
      meanStatistics in interface IOStatistics
      Returns:
      the current map of MeanStatistic statistics.
    • aggregate

      public boolean aggregate(@Nullable IOStatistics statistics)
      Description copied from interface: IOStatisticsAggregator
      Aggregate the supplied statistics into the current set.
      Specified by:
      aggregate in interface IOStatisticsAggregator
      Parameters:
      statistics - statistics; may be null
      Returns:
      true if the statistics reference was not null and so aggregated.
    • incrementCounter

      public long incrementCounter(String key, long value)
      Description copied from interface: IOStatisticsStore
      Increment a counter. No-op if the counter is unknown. If the value is negative, it is ignored.
      Specified by:
      incrementCounter in interface IOStatisticsStore
      Parameters:
      key - statistics key
      value - value to increment
      Returns:
      the updated value or, if the counter is unknown: 0
    • setCounter

      public void setCounter(String key, long value)
      Description copied from interface: IOStatisticsSetters
      Set a counter. No-op if the counter is unknown.
      Specified by:
      setCounter in interface IOStatisticsSetters
      Parameters:
      key - statistics key
      value - value to set
    • setGauge

      public void setGauge(String key, long value)
      Description copied from interface: IOStatisticsSetters
      Set a gauge.
      Specified by:
      setGauge in interface IOStatisticsSetters
      Parameters:
      key - statistics key
      value - value to set
    • incrementGauge

      public long incrementGauge(String key, long value)
      Description copied from interface: IOStatisticsStore
      Increment a gauge.

      No-op if the gauge is unknown.

      Specified by:
      incrementGauge in interface IOStatisticsStore
      Parameters:
      key - statistics key
      value - value to increment
      Returns:
      new value or 0 if the key is unknown
    • setMaximum

      public void setMaximum(String key, long value)
      Description copied from interface: IOStatisticsSetters
      Set a maximum.
      Specified by:
      setMaximum in interface IOStatisticsSetters
      Parameters:
      key - statistics key
      value - value to set
    • incrementMaximum

      public long incrementMaximum(String key, long value)
      Description copied from interface: IOStatisticsStore
      Increment a maximum.

      No-op if the maximum is unknown.

      Specified by:
      incrementMaximum in interface IOStatisticsStore
      Parameters:
      key - statistics key
      value - value to increment
      Returns:
      new value or 0 if the key is unknown
    • setMinimum

      public void setMinimum(String key, long value)
      Description copied from interface: IOStatisticsSetters
      Set a minimum.
      Specified by:
      setMinimum in interface IOStatisticsSetters
      Parameters:
      key - statistics key
      value - value to set
    • incrementMinimum

      public long incrementMinimum(String key, long value)
      Description copied from interface: IOStatisticsStore
      Increment a minimum.

      No-op if the minimum is unknown.

      Specified by:
      incrementMinimum in interface IOStatisticsStore
      Parameters:
      key - statistics key
      value - value to increment
      Returns:
      new value or 0 if the key is unknown
    • addMinimumSample

      public void addMinimumSample(String key, long value)
      Description copied from interface: IOStatisticsStore
      Add a minimum sample: if less than the current value, updates the value.

      No-op if the minimum is unknown.

      Specified by:
      addMinimumSample in interface IOStatisticsStore
      Parameters:
      key - statistics key
      value - sample value
    • addMaximumSample

      public void addMaximumSample(String key, long value)
      Description copied from interface: IOStatisticsStore
      Add a maximum sample: if greater than the current value, updates the value.

      No-op if the key is unknown.

      Specified by:
      addMaximumSample in interface IOStatisticsStore
      Parameters:
      key - statistics key
      value - sample value
    • setMeanStatistic

      public void setMeanStatistic(String key, MeanStatistic value)
      Description copied from interface: IOStatisticsSetters
      Set a mean statistic to a given value.
      Specified by:
      setMeanStatistic in interface IOStatisticsSetters
      Parameters:
      key - statistic key
      value - new value.
    • addMeanStatisticSample

      public void addMeanStatisticSample(String key, long value)
      Description copied from interface: IOStatisticsStore
      Add a sample to the mean statistics.

      No-op if the key is unknown.

      Specified by:
      addMeanStatisticSample in interface IOStatisticsStore
      Parameters:
      key - key
      value - sample value.
    • reset

      public void reset()
      Description copied from interface: IOStatisticsStore
      Reset all statistics. Unsynchronized.
      Specified by:
      reset in interface IOStatisticsStore
    • getCounterReference

      public AtomicLong getCounterReference(String key)
      Description copied from interface: IOStatisticsStore
      Get a reference to the atomic instance providing the value for a specific counter. This is useful if the value is passed around.
      Specified by:
      getCounterReference in interface IOStatisticsStore
      Parameters:
      key - statistic name
      Returns:
      the reference
    • getMaximumReference

      public AtomicLong getMaximumReference(String key)
      Description copied from interface: IOStatisticsStore
      Get a reference to the atomic instance providing the value for a specific maximum. This is useful if the value is passed around.
      Specified by:
      getMaximumReference in interface IOStatisticsStore
      Parameters:
      key - statistic name
      Returns:
      the reference
    • getMinimumReference

      public AtomicLong getMinimumReference(String key)
      Description copied from interface: IOStatisticsStore
      Get a reference to the atomic instance providing the value for a specific minimum. This is useful if the value is passed around.
      Specified by:
      getMinimumReference in interface IOStatisticsStore
      Parameters:
      key - statistic name
      Returns:
      the reference
    • getGaugeReference

      public AtomicLong getGaugeReference(String key)
      Description copied from interface: IOStatisticsStore
      Get a reference to the atomic instance providing the value for a specific gauge. This is useful if the value is passed around.
      Specified by:
      getGaugeReference in interface IOStatisticsStore
      Parameters:
      key - statistic name
      Returns:
      the reference
    • getMeanStatistic

      public MeanStatistic getMeanStatistic(String key)
      Description copied from interface: IOStatisticsStore
      Get a reference to the atomic instance providing the value for a specific meanStatistic. This is useful if the value is passed around.
      Specified by:
      getMeanStatistic in interface IOStatisticsStore
      Parameters:
      key - statistic name
      Returns:
      the reference
    • addTimedOperation

      public void addTimedOperation(String prefix, long durationMillis)
      Description copied from interface: IOStatisticsStore
      Add a duration to the min/mean/max statistics, using the given prefix and adding a suffix for each specific value. The update is not-atomic, even though each individual statistic is updated thread-safely. If two threads update the values simultaneously, at the end of each operation the state will be correct. It is only during the sequence that the statistics may be observably inconsistent.
      Specified by:
      addTimedOperation in interface IOStatisticsStore
      Parameters:
      prefix - statistic prefix
      durationMillis - duration in milliseconds.
    • addTimedOperation

      public void addTimedOperation(String prefix, Duration duration)
      Description copied from interface: IOStatisticsStore
      Add a duration to the min/mean/max statistics, using the given prefix and adding a suffix for each specific value.; increment tha counter whose name == prefix. If any of the statistics are not registered, that part of the sequence will be omitted -the rest will proceed. The update is not-atomic, even though each individual statistic is updated thread-safely. If two threads update the values simultaneously, at the end of each operation the state will be correct. It is only during the sequence that the statistics may be observably inconsistent.
      Specified by:
      addTimedOperation in interface IOStatisticsStore
      Parameters:
      prefix - statistic prefix
      duration - duration