Package org.quartz.utils.counter.sampled
Class SampledCounterImpl
- java.lang.Object
-
- org.quartz.utils.counter.CounterImpl
-
- org.quartz.utils.counter.sampled.SampledCounterImpl
-
- All Implemented Interfaces:
java.io.Serializable,Counter,SampledCounter
- Direct Known Subclasses:
SampledRateCounterImpl
public class SampledCounterImpl extends CounterImpl implements SampledCounter
An implementation ofSampledCounter- Since:
- 1.7
- Author:
- Abhishek Sanoujam
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CircularLossyQueue<TimeStampedCounterValue>historyThe history of this counterprotected booleanresetOnSampleShould the counter reset on each sample?
-
Constructor Summary
Constructors Constructor Description SampledCounterImpl(SampledCounterConfig config)Constructor accepting aSampledCounterConfig
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeStampedCounterValue[]getAllSampleValues()Returns all samples in historylonggetAndReset()Returns the current value of the counter and resets it to 0longgetIntervalMillis()Returns the sampling thread interval in millisTimeStampedCounterValuegetMostRecentSample()Returns the most recent sampled valuejava.util.TimerTaskgetTimerTask()Returns the timer task for this sampled countervoidshutdown()Shutdown this counter-
Methods inherited from class org.quartz.utils.counter.CounterImpl
decrement, decrement, getAndSet, getValue, increment, increment, setValue
-
-
-
-
Field Detail
-
history
protected final CircularLossyQueue<TimeStampedCounterValue> history
The history of this counter
-
resetOnSample
protected final boolean resetOnSample
Should the counter reset on each sample?
-
-
Constructor Detail
-
SampledCounterImpl
public SampledCounterImpl(SampledCounterConfig config)
Constructor accepting aSampledCounterConfig- Parameters:
config-
-
-
Method Detail
-
getMostRecentSample
public TimeStampedCounterValue getMostRecentSample()
Returns the most recent sampled value- Specified by:
getMostRecentSamplein interfaceSampledCounter- Returns:
- Value of the most recent sampled value
-
getAllSampleValues
public TimeStampedCounterValue[] getAllSampleValues()
Returns all samples in history- Specified by:
getAllSampleValuesin interfaceSampledCounter- Returns:
- An array containing the TimeStampedCounterValue's
-
shutdown
public void shutdown()
Shutdown this counter- Specified by:
shutdownin interfaceSampledCounter
-
getTimerTask
public java.util.TimerTask getTimerTask()
Returns the timer task for this sampled counter- Returns:
- the timer task for this sampled counter
-
getIntervalMillis
public long getIntervalMillis()
Returns the sampling thread interval in millis- Returns:
- the sampling thread interval in millis
-
getAndReset
public long getAndReset()
Returns the current value of the counter and resets it to 0- Specified by:
getAndResetin interfaceSampledCounter- Returns:
- current value of the counter
-
-