|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
org.terracotta.util.TerracottaAtomicLong
public class TerracottaAtomicLong
A Terracotta specific implementation of ClusteredAtomicLong. This implementation uses shared read/write locks to achieve atomicity. As such users should not expect performance to be on a par with the local volatile read/write based AtomicLong.
| Constructor Summary | |
|---|---|
TerracottaAtomicLong()
Constructs a TerracottaAtomicLong whose initial long value is zero. |
|
TerracottaAtomicLong(long value)
Constructs a TerracottaAtomicLong with the supplied initial long value. |
|
| Method Summary | |
|---|---|
long |
addAndGet(long delta)
Atomically add the supplied value to the current value. |
boolean |
compareAndSet(long expect,
long update)
Atomically set the value to the new value if the current value == the given value. |
long |
decrementAndGet()
Atomically decrement the current value. |
double |
doubleValue()
Number.doubleValue() |
float |
floatValue()
Number.floatValue() |
long |
get()
Get the current value. |
long |
getAndAdd(long delta)
Atomically add the supplied value to the current value. |
long |
getAndDecrement()
Atomically decrement the current value. |
long |
getAndIncrement()
Atomically increment the current value. |
long |
getAndSet(long newValue)
Atomically: set to the given value and return the previous value. |
long |
incrementAndGet()
Atomically increment the current value |
int |
intValue()
Number.intValue() |
long |
longValue()
Number.longValue() |
void |
set(long newValue)
Set to the given value |
String |
toString()
|
boolean |
weakCompareAndSet(long expect,
long update)
Atomically set the value to the new value if the current value == the given value. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.terracotta.util.ClusteredAtomicLong |
|---|
byteValue, shortValue |
| Constructor Detail |
|---|
public TerracottaAtomicLong()
public TerracottaAtomicLong(long value)
value - the initial value| Method Detail |
|---|
public long addAndGet(long delta)
ClusteredAtomicLong
addAndGet in interface ClusteredAtomicLongdelta - the value to add
public boolean compareAndSet(long expect,
long update)
ClusteredAtomicLong
compareAndSet in interface ClusteredAtomicLongexpect - the expected valueupdate - the new value
public long decrementAndGet()
ClusteredAtomicLong
decrementAndGet in interface ClusteredAtomicLongpublic long get()
ClusteredAtomicLong
get in interface ClusteredAtomicLongpublic long getAndAdd(long delta)
ClusteredAtomicLong
getAndAdd in interface ClusteredAtomicLongdelta - the value to add
public long getAndDecrement()
ClusteredAtomicLong
getAndDecrement in interface ClusteredAtomicLongpublic long getAndIncrement()
ClusteredAtomicLong
getAndIncrement in interface ClusteredAtomicLongpublic long getAndSet(long newValue)
ClusteredAtomicLong
getAndSet in interface ClusteredAtomicLongnewValue - the new value
public long incrementAndGet()
ClusteredAtomicLong
incrementAndGet in interface ClusteredAtomicLongpublic void set(long newValue)
ClusteredAtomicLong
set in interface ClusteredAtomicLongnewValue - the new value
public boolean weakCompareAndSet(long expect,
long update)
ClusteredAtomicLongMay fail spuriously. Repeated uncontended valid calls will eventually succeed however.
weakCompareAndSet in interface ClusteredAtomicLongexpect - the expected valueupdate - the new value
public int intValue()
ClusteredAtomicLongNumber.intValue()
intValue in interface ClusteredAtomicLongintValue in class Numberpublic long longValue()
ClusteredAtomicLongNumber.longValue()
longValue in interface ClusteredAtomicLonglongValue in class Numberpublic float floatValue()
ClusteredAtomicLongNumber.floatValue()
floatValue in interface ClusteredAtomicLongfloatValue in class Numberpublic double doubleValue()
ClusteredAtomicLongNumber.doubleValue()
doubleValue in interface ClusteredAtomicLongdoubleValue in class Numberpublic String toString()
toString in interface ClusteredAtomicLongtoString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||