AtomicLong
public
class
AtomicLong
extends Number
implements
Serializable
| java.lang.Object | ||
| ↳ | java.lang.Number | |
| ↳ | java.util.concurrent.atomic.AtomicLong | |
A long value that may be updated atomically. See the
VarHandle specification for descriptions of the properties
of atomic accesses. An AtomicLong is used in applications
such as atomically incremented sequence numbers, and cannot be used
as a replacement for a Long. However, this class
does extend Number to allow uniform access by tools and
utilities that deal with numerically-based classes.
Summary
Public constructors | |
|---|---|
AtomicLong()
Creates a new AtomicLong with initial value |
|
AtomicLong(long initialValue)
Creates a new AtomicLong with the given initial value. |
|
Public methods | |
|---|---|
final
long
|
accumulateAndGet(long x, LongBinaryOperator accumulatorFunction)
Atomically updates (with memory effects as specified by |
final
long
|
addAndGet(long delta)
Atomically adds the given value to the current value,
with memory effects as specified by |
final
long
|
compareAndExchange(long expectedValue, long newValue)
Atomically sets the value to |
final
long
|
compareAndExchangeAcquire(long expectedValue, long newValue)
Atomically sets the value to |
final
long
|
compareAndExchangeRelease(long expectedValue, long newValue)
Atomically sets the value to |
final
boolean
|
compareAndSet(long expectedValue, long newValue)
Atomically sets the value to |
final
long
|
decrementAndGet()
Atomically decrements the current value,
with memory effects as specified by |
double
|
doubleValue()
Returns the current value of this |
float
|
|