public class CounterStatistic extends 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 AtomicLong |
_curr |
protected AtomicLong |
_max |
protected AtomicLong |
_total |
Constructor and Description |
---|
CounterStatistic() |
Modifier and Type | Method and Description |
---|---|
void |
add(long delta) |
void |
decrement() |
long |
getCurrent() |
long |
getMax() |
long |
getTotal() |
void |
increment() |
void |
reset() |
void |
reset(long value) |
void |
subtract(long delta) |
protected void |
upxdateMax(long value) |
protected final AtomicLong _max
protected final AtomicLong _curr
protected final AtomicLong _total
public void reset()
public void reset(long value)
public void add(long delta)
delta
- the amount to add to the countpublic void subtract(long delta)
delta
- the amount to subtract the count by.public void increment()
public void decrement()
public long getMax()
public long getCurrent()
public long getTotal()
protected void upxdateMax(long value)
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.