|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.counter.SimpleCounterImpl
org.terracotta.counter.BoundedCounter
public class BoundedCounter
A bounded counter implementation that prevents it's value from exceeded a pre-defined set of bounds.
Any setting operation which would cause an out-of-bounds condition is ignored.
| Constructor Summary | |
|---|---|
BoundedCounter(long initialValue,
long minValue,
long maxValue)
Creates a bounded counter with the given initial value and bounds. |
|
| Method Summary | |
|---|---|
long |
decrement()
Decrements the count by one. |
long |
decrement(long amount)
Decrements the count by amount. |
long |
getAndSet(long newValue)
Atomically sets the new value and returns the previous value. |
long |
increment()
Increments the count by one. |
long |
increment(long amount)
Increments the count by amount. |
void |
setValue(long newValue)
Set the count to the supplied value. |
| Methods inherited from class org.terracotta.counter.SimpleCounterImpl |
|---|
getAndReset, getValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BoundedCounter(long initialValue,
long minValue,
long maxValue)
initialValue - the initial counter valueminValue - the inclusive upper boundmaxValue - the inclusive lower bound| Method Detail |
|---|
public long decrement()
Counter
decrement in interface Counterdecrement in class SimpleCounterImplpublic long decrement(long amount)
Counter
decrement in interface Counterdecrement in class SimpleCounterImplamount - amount to increment by
public long getAndSet(long newValue)
SimpleCounterImpl
getAndSet in interface CountergetAndSet in class SimpleCounterImplnewValue - value to set to
public long increment()
Counter
increment in interface Counterincrement in class SimpleCounterImplpublic long increment(long amount)
Counter
increment in interface Counterincrement in class SimpleCounterImplamount - amount to increment by
public void setValue(long newValue)
Counter
setValue in interface CountersetValue in class SimpleCounterImplnewValue - value to set to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||