|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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 Class |
s_clzImplementation
The 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. |
String |
toString()
Return the count as a string. |
Field Detail |
---|
protected static Class s_clzImplementation
Constructor Detail |
---|
public AtomicCounter()
Method Detail |
---|
public long increment()
public long increment(long c)
c
- the amount to increment the counter by
public long postIncrement()
public long postIncrement(long c)
c
- the amount to increment the counter by
public long decrement()
public long decrement(long c)
c
- the amount to decrement the counter by
public long postDecrement()
public long postDecrement(long c)
c
- the amount to decrement the counter by
public abstract long getCount()
public abstract boolean setCount(long cAssume, long cNew)
cAssume
- the assumed old valuecNew
- the new value
public abstract long setCount(long cNew)
cNew
- the new value
public String toString()
protected abstract long adjust(long c)
c
- the amount to adjust the counter by
protected abstract long postAdjust(long c)
c
- the amount to adjust the counter by
public static AtomicCounter newAtomicCounter()
public static AtomicCounter newAtomicCounter(long l)
l
- the initial counter value
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |