public class ResetPeriodicallyCounter extends Object implements WindowCounter
Concurrency properties:
Usage recommendations:
SmoothlyDecayingRollingCounterSmoothlyDecayingRollingCounter| Constructor and Description |
|---|
ResetPeriodicallyCounter(Duration resetInterval)
Constructs the counter which reset its state to zero each time when
resetInterval is elapsed. |
ResetPeriodicallyCounter(Duration resetInterval,
Ticker ticker) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(long delta)
Increment the counter by
delta. |
long |
getSum()
Returns the counter's current value.
|
String |
toString() |
public ResetPeriodicallyCounter(Duration resetInterval)
resetInterval is elapsed.resetInterval - the interval between counter resettingpublic void add(long delta)
WindowCounterdelta.
If You want to decrement instead of increment then use negative delta.add in interface WindowCounterdelta - the amount by which the counter will be increasedpublic long getSum()
WindowCountergetSum in interface WindowCounterCopyright © 2020. All rights reserved.