|
Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.AtomicCounter
public abstract class AtomicCounter
Abstract base class for AtomicCounters. The AtomicCounter allows for atomic updates to a "long" value where possible without requiring synchronization. The underlying AtomicCounter impelementation will be choosen based at runtime.
| Field Summary | |
|---|---|
protected static java.lang.Class |
s_clzImplementationThe counter implementation which will be used. |
| Constructor Summary | |
|---|---|
AtomicCounter() |
|
| Method Summary | |
|---|---|
protected abstract long |
adjust(long c)Adjust the value of the counter by the specified amount, and return the new value. |
long |
decrement()Decrement the value, and return the new value. |
long |
decrement(long c)Decrement the value by c, and return the new value. |
abstract long |
getCount()Return the current value of the counter. |
long |
increment()Incremenet the value, and return the new value. |
long |
increment(long c)Incremenet the value by c, and return the new value. |
static AtomicCounter |
newAtomicCounter()Instantiate and return a new AtomicCounter. |
static AtomicCounter |
newAtomicCounter(long l)Instantiate and return a new AtomicCounter initialized to a particular value. |
protected abstract long |
postAdjust(long c)Adjust the value of the counter by the specified amount, and return the old value. |
long |
postDecrement()Decrement the value, and return the original value. |
long |
postDecrement(long c)Decrement the value by c, and return the original value. |
long |
postIncrement()Incremenet the value, and return the original value. |
long |
postIncrement(long c)Incremenet the value by c, and return the original value. |
abstract long |
setCount(long cNew)Update the current value, and return the previous value. |
abstract boolean |
setCount(long cAssume, long cNew)Update the current value, only if it is equal to the assumed value. |
java.lang.String |
toString()Return the count as a string. |
| Field Detail |
|---|
protected static java.lang.Class s_clzImplementation
| Constructor Detail |
|---|
public AtomicCounter()
| Method Detail |
|---|
public long increment()
public long increment(long c)
c - the amount to increment the counter bypublic long postIncrement()
public long postIncrement(long c)
c - the amount to increment the counter bypublic long decrement()
public long decrement(long c)
c - the amount to decrement the counter bypublic long postDecrement()
public long postDecrement(long c)
c - the amount to decrement the counter bypublic abstract long getCount()
public abstract boolean setCount(long cAssume,
long cNew)
cAssume - the assumed old valuecNew - the new valuepublic abstract long setCount(long cNew)
cNew - the new valuepublic java.lang.String toString()
protected abstract long adjust(long c)
c - the amount to adjust the counter byprotected abstract long postAdjust(long c)
c - the amount to adjust the counter bypublic static AtomicCounter newAtomicCounter()
public static AtomicCounter newAtomicCounter(long l)
l - the initial counter value
|
Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||