|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.counter.SimpleCounterImpl
public class SimpleCounterImpl
A simple non-clusterable atomic counter implementation.
| Constructor Summary | |
|---|---|
SimpleCounterImpl()
Creates a new counter with an initial value of 0. |
|
SimpleCounterImpl(long initialValue)
Creates a new counter with the given initial value. |
|
| Method Summary | |
|---|---|
long |
decrement()
Decrements the count by one. |
long |
decrement(long amount)
Decrements the count by amount. |
long |
getAndReset()
Performs an atomic getAndSet(0). |
long |
getAndSet(long newValue)
Atomically sets the new value and returns the previous value. |
long |
getValue()
Get the current 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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleCounterImpl()
public SimpleCounterImpl(long initialValue)
initialValue - initial value for the counter| Method Detail |
|---|
public long increment()
Counter
increment in interface Counterpublic long decrement()
Counter
decrement in interface Counterpublic long getAndSet(long newValue)
getAndSet in interface CounternewValue - value to set to
public long getAndReset()
getAndReset in interface Statisticpublic long getValue()
Statistic
getValue in interface Statisticpublic long increment(long amount)
Counter
increment in interface Counteramount - amount to increment by
public long decrement(long amount)
Counter
decrement in interface Counteramount - amount to increment by
public void setValue(long newValue)
Counter
setValue in interface CounternewValue - value to set to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||