Class LocalAtomicLong
- java.lang.Object
-
- java.lang.Number
-
- com.oracle.coherence.concurrent.atomic.LocalAtomicLong
-
- All Implemented Interfaces:
AtomicLong,Serializable
public class LocalAtomicLong extends Number implements AtomicLong
Local implementation ofAtomicLonginterface, that simply wrapsjava.util.concurrent.atomic.AtomicLonginstance.- Since:
- 21.12
- Author:
- Aleks Seovic 2020.12.03
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.oracle.coherence.concurrent.atomic.AtomicLong
AtomicLong.Serializer
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longaccumulateAndGet(long lUpdate, Remote.LongBinaryOperator accumulatorFunction)Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.longaccumulateAndGet(long lUpdate, LongBinaryOperator accumulatorFunction)Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.longaddAndGet(long lDelta)Atomically adds the given value to the current value.AsyncLocalAtomicLongasync()Return non-blocking API for this atomic value.bytebyteValue()Returns the current value of thisAtomicLongas abyteafter a narrowing primitive conversion.longcompareAndExchange(long lExpectedValue, long lNewValue)Atomically sets the value tonewValueif the current value, referred to as the witness value,== expectedValue.booleancompareAndSet(long lExpectedValue, long lNewValue)Atomically sets the value tonewValueif the current value== expectedValue.longdecrementAndGet()Atomically decrements the current value.doubledoubleValue()Returns the current value of thisAtomicLongas adoubleafter a widening primitive conversion.floatfloatValue()Returns the current value of thisAtomicLongas afloatafter a widening primitive conversion.longget()Returns the current value.longgetAndAccumulate(long lUpdate, Remote.LongBinaryOperator accumulatorFunction)Atomically updates the current value with the results of applying the given function to the current and given values, returning the previous value.longgetAndAccumulate(long lUpdate, LongBinaryOperator accumulatorFunction)Atomically updates the current value with the results of applying the given function to the current and given values, returning the previous value.longgetAndAdd(long lDelta)Atomically adds the given value to the current value.longgetAndDecrement()Atomically decrements the current value.longgetAndIncrement()Atomically increments the current value.longgetAndSet(long lNewValue)Atomically sets the value tonewValueand returns the old value.longgetAndUpdate(Remote.LongUnaryOperator updateFunction)Atomically updates the current value with the results of applying the given function, returning the previous value.longgetAndUpdate(LongUnaryOperator updateFunction)Atomically updates the current value with the results of applying the given function, returning the previous value.longincrementAndGet()Atomically increments the current value.intintValue()Returns the current value of thisAtomicLongas anintafter a narrowing primitive conversion.longlongValue()Returns the current value of thisAtomicLongas along.voidset(long lNewValue)Sets the value tonewValue.shortshortValue()Returns the current value of thisAtomicLongas ashortafter a narrowing primitive conversion.StringtoString()longupdateAndGet(Remote.LongUnaryOperator updateFunction)Atomically updates the current value with the results of applying the given function, returning the updated value.longupdateAndGet(LongUnaryOperator updateFunction)Atomically updates the current value with the results of applying the given function, returning the updated value.
-
-
-
Method Detail
-
async
public AsyncLocalAtomicLong async()
Description copied from interface:AtomicLongReturn non-blocking API for this atomic value.- Specified by:
asyncin interfaceAtomicLong- Returns:
- non-blocking API for this atomic value
-
get
public long get()
Description copied from interface:AtomicLongReturns the current value.- Specified by:
getin interfaceAtomicLong- Returns:
- the current value
-
set
public void set(long lNewValue)
Description copied from interface:AtomicLongSets the value tonewValue.- Specified by:
setin interfaceAtomicLong- Parameters:
lNewValue- the new value
-
getAndSet
public long getAndSet(long lNewValue)
Description copied from interface:AtomicLongAtomically sets the value tonewValueand returns the old value.- Specified by:
getAndSetin interfaceAtomicLong- Parameters:
lNewValue- the new value- Returns:
- the previous value
-
compareAndSet
public boolean compareAndSet(long lExpectedValue, long lNewValue)Description copied from interface:AtomicLongAtomically sets the value tonewValueif the current value== expectedValue.- Specified by:
compareAndSetin interfaceAtomicLong- Parameters:
lExpectedValue- the expected valuelNewValue- the new value- Returns:
trueif successful. False return indicates that the actual value was not equal to the expected value.
-
getAndIncrement
public long getAndIncrement()
Description copied from interface:AtomicLongAtomically increments the current value.Equivalent to
getAndAdd(1).- Specified by:
getAndIncrementin interfaceAtomicLong- Returns:
- the previous value
-
getAndDecrement
public long getAndDecrement()
Description copied from interface:AtomicLongAtomically decrements the current value.Equivalent to
getAndAdd(-1).- Specified by:
getAndDecrementin interfaceAtomicLong- Returns:
- the previous value
-
getAndAdd
public long getAndAdd(long lDelta)
Description copied from interface:AtomicLongAtomically adds the given value to the current value.- Specified by:
getAndAddin interfaceAtomicLong- Parameters:
lDelta- the value to add- Returns:
- the previous value
-
incrementAndGet
public long incrementAndGet()
Description copied from interface:AtomicLongAtomically increments the current value.Equivalent to
addAndGet(1).- Specified by:
incrementAndGetin interfaceAtomicLong- Returns:
- the updated value
-
decrementAndGet
public long decrementAndGet()
Description copied from interface:AtomicLongAtomically decrements the current value.Equivalent to
addAndGet(-1).- Specified by:
decrementAndGetin interfaceAtomicLong- Returns:
- the updated value
-
addAndGet
public long addAndGet(long lDelta)
Description copied from interface:AtomicLongAtomically adds the given value to the current value.- Specified by:
addAndGetin interfaceAtomicLong- Parameters:
lDelta- the value to add- Returns:
- the updated value
-
getAndUpdate
public long getAndUpdate(Remote.LongUnaryOperator updateFunction)
Description copied from interface:AtomicLongAtomically updates the current value with the results of applying the given function, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.- Specified by:
getAndUpdatein interfaceAtomicLong- Parameters:
updateFunction- a side-effect-free function- Returns:
- the previous value
-
getAndUpdate
public long getAndUpdate(LongUnaryOperator updateFunction)
Description copied from interface:AtomicLongAtomically updates the current value with the results of applying the given function, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.- Specified by:
getAndUpdatein interfaceAtomicLong- Parameters:
updateFunction- a side-effect-free function- Returns:
- the previous value
-
updateAndGet
public long updateAndGet(Remote.LongUnaryOperator updateFunction)
Description copied from interface:AtomicLongAtomically updates the current value with the results of applying the given function, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.- Specified by:
updateAndGetin interfaceAtomicLong- Parameters:
updateFunction- a side-effect-free function- Returns:
- the updated value
-
updateAndGet
public long updateAndGet(LongUnaryOperator updateFunction)
Description copied from interface:AtomicLongAtomically updates the current value with the results of applying the given function, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.- Specified by:
updateAndGetin interfaceAtomicLong- Parameters:
updateFunction- a side-effect-free function- Returns:
- the updated value
-
getAndAccumulate
public long getAndAccumulate(long lUpdate, Remote.LongBinaryOperator accumulatorFunction)Description copied from interface:AtomicLongAtomically updates the current value with the results of applying the given function to the current and given values, returning the previous value.The function should beside-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.
- Specified by:
getAndAccumulatein interfaceAtomicLong- Parameters:
lUpdate- the update valueaccumulatorFunction- a side-effect-free function of two arguments- Returns:
- the previous value
-
getAndAccumulate
public long getAndAccumulate(long lUpdate, LongBinaryOperator accumulatorFunction)Description copied from interface:AtomicLongAtomically updates the current value with the results of applying the given function to the current and given values, returning the previous value.The function should beside-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.
- Specified by:
getAndAccumulatein interfaceAtomicLong- Parameters:
lUpdate- the update valueaccumulatorFunction- a side-effect-free function of two arguments- Returns:
- the previous value
-
accumulateAndGet
public long accumulateAndGet(long lUpdate, Remote.LongBinaryOperator accumulatorFunction)Description copied from interface:AtomicLongAtomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.
- Specified by:
accumulateAndGetin interfaceAtomicLong- Parameters:
lUpdate- the update valueaccumulatorFunction- a side-effect-free function of two arguments- Returns:
- the updated value
-
accumulateAndGet
public long accumulateAndGet(long lUpdate, LongBinaryOperator accumulatorFunction)Description copied from interface:AtomicLongAtomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.
- Specified by:
accumulateAndGetin interfaceAtomicLong- Parameters:
lUpdate- the update valueaccumulatorFunction- a side-effect-free function of two arguments- Returns:
- the updated value
-
compareAndExchange
public long compareAndExchange(long lExpectedValue, long lNewValue)Description copied from interface:AtomicLongAtomically sets the value tonewValueif the current value, referred to as the witness value,== expectedValue.- Specified by:
compareAndExchangein interfaceAtomicLong- Parameters:
lExpectedValue- the expected valuelNewValue- the new value- Returns:
- the witness value, which will be the same as the expected value if successful
-
intValue
public int intValue()
Description copied from interface:AtomicLongReturns the current value of thisAtomicLongas anintafter a narrowing primitive conversion.- Specified by:
intValuein interfaceAtomicLong- Specified by:
intValuein classNumber- Returns:
- the numeric value represented by this object after conversion
to type
int
-
longValue
public long longValue()
Description copied from interface:AtomicLongReturns the current value of thisAtomicLongas along.- Specified by:
longValuein interfaceAtomicLong- Specified by:
longValuein classNumber- Returns:
- the numeric value represented by this object
-
floatValue
public float floatValue()
Description copied from interface:AtomicLongReturns the current value of thisAtomicLongas afloatafter a widening primitive conversion.- Specified by:
floatValuein interfaceAtomicLong- Specified by:
floatValuein classNumber- Returns:
- the numeric value represented by this object after conversion
to type
float
-
doubleValue
public double doubleValue()
Description copied from interface:AtomicLongReturns the current value of thisAtomicLongas adoubleafter a widening primitive conversion.- Specified by:
doubleValuein interfaceAtomicLong- Specified by:
doubleValuein classNumber- Returns:
- the numeric value represented by this object after conversion
to type
double
-
byteValue
public byte byteValue()
Description copied from interface:AtomicLongReturns the current value of thisAtomicLongas abyteafter a narrowing primitive conversion.- Specified by:
byteValuein interfaceAtomicLong- Overrides:
byteValuein classNumber- Returns:
- the numeric value represented by this object after conversion
to type
byte
-
shortValue
public short shortValue()
Description copied from interface:AtomicLongReturns the current value of thisAtomicLongas ashortafter a narrowing primitive conversion.- Specified by:
shortValuein interfaceAtomicLong- Overrides:
shortValuein classNumber- Returns:
- the numeric value represented by this object after conversion
to type
short
-
-