public class RateTracker extends Object implements Closeable
This class is a utility to track the rate of something.
| Constructor and Description |
|---|
RateTracker(int validTimeWindowInMils,
int numBuckets)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
notify(long count)
Notify the tracker upon new arrivals.
|
double |
reportRate()
Get report rate.
|
public RateTracker(int validTimeWindowInMils,
int numBuckets)
Constructor.
validTimeWindowInMils - events that happened before validTimeWindowInMils are not considered when reporting the rate.numBuckets - the number of time sildes to divide validTimeWindows. The more buckets, the smother the reported results will be.public void notify(long count)
Notify the tracker upon new arrivals.
count - number of arrivalspublic double reportRate()
Get report rate.
public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2021 The Apache Software Foundation. All rights reserved.