public final class SlidingWindowCounter extends 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 | 
clear()
Clears the counter. 
 | 
void | 
destroy()
Releases resources used by the SlidingWindowCounter. 
 | 
long | 
get(int slots)
Deprecated. 
 
since 1.12 
 | 
long | 
getOverallCount()
Returns the overall number of increments. 
 | 
double | 
getOverallRate()
Returns the overall rate. 
 | 
long | 
getWindowCount()
Gets the total count for all slots. 
 | 
long | 
getWindowCount(int slots)
Gets the total count for the last N window slots. 
 | 
double | 
getWindowRate()
Returns the average rate over the window. 
 | 
double | 
getWindowRate(int slots)
Returns the average rate over the given window. 
 | 
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 by@Deprecated public long get(int slots)
slots - number of slots to include in the countpublic long getWindowCount()
public long getWindowCount(int slots)
slots - number of slots to include in the countpublic double getWindowRate()
public double getWindowRate(int slots)
slots - the number of slots to include in the windowpublic long getOverallCount()
public double getOverallRate()
public void clear()