public final class SlidingWindowCounter
extends java.lang.Object
Constructor and Description |
---|
SlidingWindowCounter(int windowSlots)
Creates a new sliding window counter with the given total number of
window slots.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Releases resources used by the SlidingWindowCounter.
|
long |
get(int slots)
Gets the total count for the last N window slots.
|
void |
incrementCount()
Increments the count of the current window slot by 1.
|
void |
incrementCount(long value)
Increments the count of the current window slot by the given value.
|
public SlidingWindowCounter(int windowSlots)
windowSlots
- total number of window slotspublic void destroy()
public void incrementCount()
public void incrementCount(long value)
value
- value to increment bypublic long get(int slots)
slots
- number of slots to include in the count