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 Summary
Constructors Constructor Description NullCounters()
Creates a new instance of the counter. -
Method Summary
Modifier and Type Method Description Timing
beginTiming(String name)
Begins measurement of execution time interval.void
increment(String name, int value)
Increments counter by given value.void
incrementOne(String name)
Increments counter by 1.void
last(String name, float value)
Records the last calculated measurement value.void
stats(String name, float value)
Calculates min/average/max statistics based on the current and previous values.void
timestamp(String name, ZonedDateTime value)
Records the given timestamp.void
timestampNow(String name)
Records the current time as a timestamp.
-
Constructor Details
-
NullCounters
public NullCounters()Creates a new instance of the counter.
-
-
Method Details
-
beginTiming
Begins measurement of execution time interval. It returns Timing object which has to be called atTiming.endTiming()
to end the measurement and update the counter.- Specified by:
beginTiming
in interfaceICounters
- Parameters:
name
- a counter name of Interval type.- Returns:
- a Timing callback object to end timing.
-
stats
Calculates min/average/max statistics based on the current and previous values. -
last
Records the last calculated measurement value. Usually this method is used by metrics calculated externally. -
timestampNow
Records the current time as a timestamp.- Specified by:
timestampNow
in interfaceICounters
- Parameters:
name
- a counter name of Timestamp type.
-
timestamp
Records the given timestamp. -
incrementOne
Increments counter by 1.- Specified by:
incrementOne
in interfaceICounters
- Parameters:
name
- a counter name of Increment type.
-
increment
Increments counter by given value.
-