public class CounterStatistic
extends java.lang.Object
Keep total, current and maximum values of a counter that can be incremented and decremented. The total refers only to increments.
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicLong |
_current |
protected java.util.concurrent.atomic.LongAccumulator |
_max |
protected java.util.concurrent.atomic.LongAdder |
_total |
Constructor and Description |
---|
CounterStatistic() |
Modifier and Type | Method and Description |
---|---|
long |
add(long delta) |
long |
decrement()
decrement by 1
|
long |
getCurrent() |
long |
getMax() |
long |
getTotal() |
long |
increment()
increment the value by one
|
void |
reset() |
void |
reset(long value) |
java.lang.String |
toString() |
protected final java.util.concurrent.atomic.LongAccumulator _max
protected final java.util.concurrent.atomic.AtomicLong _current
protected final java.util.concurrent.atomic.LongAdder _total
public void reset()
public void reset(long value)
public long add(long delta)
delta
- the amount to add to the countpublic long increment()
public long decrement()
public long getMax()
public long getCurrent()
public long getTotal()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2017 Webtide. All rights reserved.