public class SampledCounterImpl extends CounterImpl implements SampledCounter
SampledCounter
Modifier and Type | Field and Description |
---|---|
protected CircularLossyQueue<TimeStampedCounterValue> |
history
The history of this counter
|
private long |
intervalMillis |
private static int |
MILLIS_PER_SEC |
protected boolean |
resetOnSample
Should the counter reset on each sample?
|
private java.util.TimerTask |
samplerTask |
Constructor and Description |
---|
SampledCounterImpl(SampledCounterConfig config)
todo GL how many threads is this creating?
Constructor accepting a
SampledCounterConfig |
Modifier and Type | Method and Description |
---|---|
TimeStampedCounterValue[] |
getAllSampleValues()
Returns all samples in history
|
long |
getAndReset()
Returns the current value of the counter and resets it to 0
|
long |
getIntervalMillis()
Returns the sampling thread interval in millis
|
TimeStampedCounterValue |
getMostRecentSample()
Returns the most recent sampled value
|
java.util.TimerTask |
getTimerTask()
Returns the timer task for this sampled counter
|
(package private) void |
recordSample() |
void |
shutdown()
Shutdown this counter
|
decrement, decrement, getAndSet, getValue, increment, increment, setValue
private static final int MILLIS_PER_SEC
protected final CircularLossyQueue<TimeStampedCounterValue> history
protected final boolean resetOnSample
private final java.util.TimerTask samplerTask
private final long intervalMillis
public SampledCounterImpl(SampledCounterConfig config)
SampledCounterConfig
config
- public TimeStampedCounterValue getMostRecentSample()
getMostRecentSample
in interface SampledCounter
public TimeStampedCounterValue[] getAllSampleValues()
getAllSampleValues
in interface SampledCounter
public void shutdown()
shutdown
in interface SampledCounter
public java.util.TimerTask getTimerTask()
public long getIntervalMillis()
void recordSample()
public long getAndReset()
getAndReset
in interface SampledCounter