Class NullCounters

java.lang.Object
org.pipservices3.components.count.NullCounters
All Implemented Interfaces:
ICounters

public class NullCounters
extends Object
implements ICounters
Dummy implementation of performance counters that doesn't do anything.

It can be used in testing or in situations when counters is required but shall be disabled.

See Also:
ICounters
  • Constructor Details

    • NullCounters

      public NullCounters()
      Creates a new instance of the counter.
  • Method Details

    • beginTiming

      public Timing beginTiming​(String name)
      Begins measurement of execution time interval. It returns Timing object which has to be called at Timing.endTiming() to end the measurement and update the counter.
      Specified by:
      beginTiming in interface ICounters
      Parameters:
      name - a counter name of Interval type.
      Returns:
      a Timing callback object to end timing.
    • stats

      public void stats​(String name, float value)
      Calculates min/average/max statistics based on the current and previous values.
      Specified by:
      stats in interface ICounters
      Parameters:
      name - a counter name of Statistics type
      value - a value to update statistics
    • last

      public void last​(String name, float value)
      Records the last calculated measurement value. Usually this method is used by metrics calculated externally.
      Specified by:
      last in interface ICounters
      Parameters:
      name - a counter name of Last type.
      value - a last value to record.
    • timestampNow

      public void timestampNow​(String name)
      Records the current time as a timestamp.
      Specified by:
      timestampNow in interface ICounters
      Parameters:
      name - a counter name of Timestamp type.
    • timestamp

      public void timestamp​(String name, ZonedDateTime value)
      Records the given timestamp.
      Specified by:
      timestamp in interface ICounters
      Parameters:
      name - a counter name of Timestamp type.
      value - a timestamp to record.
    • incrementOne

      public void incrementOne​(String name)
      Increments counter by 1.
      Specified by:
      incrementOne in interface ICounters
      Parameters:
      name - a counter name of Increment type.
    • increment

      public void increment​(String name, int value)
      Increments counter by given value.
      Specified by:
      increment in interface ICounters
      Parameters:
      name - a counter name of Increment type.
      value - a value to add to the counter.