VarHandle
specification for descriptions of the properties of
atomic accesses.
Modifier and Type | Field and Description |
---|---|
private static final long | |
private static final VarHandle | |
private volatile V |
Access | Constructor and Description |
---|---|
public | AtomicReference(V
the initial value initialValue)Creates a new AtomicReference with the given initial value. |
public |
Modifier and Type | Method and Description |
---|---|
public final V | Returns: the updated valuethe update value x, BinaryOperator<V> a side-effect-free function of two arguments accumulatorFunction)Atomically updates (with memory effects as specified by |
public final V | Returns: the witness value, which will be the same as the expected value if successfulthe expected value expectedValue, V the new value newValue)Atomically sets the value to |
public final V | Returns: the witness value, which will be the same as the expected value if successfulthe expected value expectedValue, V the new value newValue)Atomically sets the value to |
public final V | Returns: the witness value, which will be the same as the expected value if successfulthe expected value expectedValue, V the new value newValue)Atomically sets the value to |
public final boolean | Returns: true if successful. False return indicates that
the actual value was not equal to the expected value.the expected value expectedValue, V the new value newValue)Atomically sets the value to |
public final V | Returns: the current valueReturns the current value,
with memory effects as specified by |
public final V | Returns: the valueReturns the current value,
with memory effects as specified by |
public final V | Returns: the previous valuethe update value x, BinaryOperator<V> a side-effect-free function of two arguments accumulatorFunction)Atomically updates (with memory effects as specified by |
public final V | Returns: the previous valuethe new value newValue)Atomically sets the value to |
public final V | Returns: the previous valuea side-effect-free function updateFunction)Atomically updates (with memory effects as specified by |
public final V | Returns: the valueReturns the current value,
with memory effects as specified by |
public final V | Returns: the valueReturns the current value, with memory semantics of reading as
if the variable was declared non- |
public final void | lazySet(V
the new value newValue)Sets the value to |
public final void | set(V
the new value newValue)Sets the value to |
public final void | setOpaque(V
the new value newValue)Sets the value to |
public final void | setPlain(V
the new value newValue)Sets the value to |
public final void | setRelease(V
the new value newValue)Sets the value to |
public String | Returns: the String representation of the current valueOverrides java. |
public final V | Returns: the updated valuea side-effect-free function updateFunction)Atomically updates (with memory effects as specified by |
public final boolean | Returns: true if successfulthe expected value expectedValue, V the new value newValue)
Deprecated
since 9. This method has plain memory effects but the method
name implies volatile memory effects (see methods such as
Possibly atomically sets the value to compareAndExchange and compareAndSet ).
newValue
if the current value == expectedValue ,
with memory effects as specified by VarHandle#weakCompareAndSetPlain .
|
public final boolean | Returns: true if successfulthe expected value expectedValue, V the new value newValue)Possibly atomically sets the value to |
public final boolean | Returns: true if successfulthe expected value expectedValue, V the new value newValue)Possibly atomically sets the value to |
public final boolean | Returns: true if successfulthe expected value expectedValue, V the new value newValue)Possibly atomically sets the value to |
public final boolean | Returns: true if successfulthe expected value expectedValue, V the new value newValue)Possibly atomically sets the value to |
serialVersionUID | back to summary |
---|---|
private static final long serialVersionUID |
VALUE | back to summary |
---|---|
private static final VarHandle VALUE |
value | back to summary |
---|---|
private volatile V value
|
AtomicReference | back to summary |
---|---|
public AtomicReference(V initialValue) Creates a new AtomicReference with the given initial value.
|
AtomicReference | back to summary |
---|---|
public AtomicReference() Creates a new AtomicReference with null initial value. |
accumulateAndGet | back to summary |
---|---|
public final V accumulateAndGet(V x, BinaryOperator<V> accumulatorFunction) Atomically updates (with memory effects as specified by
|
compareAndExchange | back to summary |
---|---|
public final V compareAndExchange(V expectedValue, V newValue) Atomically sets the value to
|
compareAndExchangeAcquire | back to summary |
---|---|
public final V compareAndExchangeAcquire(V expectedValue, V newValue) Atomically sets the value to
|
compareAndExchangeRelease | back to summary |
---|---|
public final V compareAndExchangeRelease(V expectedValue, V newValue) Atomically sets the value to
|
compareAndSet | back to summary |
---|---|
public final boolean compareAndSet(V expectedValue, V newValue) Atomically sets the value to
|
get | back to summary |
---|---|
public final V get() Returns the current value,
with memory effects as specified by
|
getAcquire | back to summary |
---|---|
public final V getAcquire() Returns the current value,
with memory effects as specified by
|
getAndAccumulate | back to summary |
---|---|
public final V getAndAccumulate(V x, BinaryOperator<V> accumulatorFunction) Atomically updates (with memory effects as specified by
|
getAndSet | back to summary |
---|---|
public final V getAndSet(V newValue) Atomically sets the value to
|
getAndUpdate | back to summary |
---|---|
public final V getAndUpdate(UnaryOperator<V> updateFunction) Atomically updates (with memory effects as specified by
|
getOpaque | back to summary |
---|---|
public final V getOpaque() Returns the current value,
with memory effects as specified by
|
getPlain | back to summary |
---|---|
public final V getPlain() Returns the current value, with memory semantics of reading as
if the variable was declared non-
|
lazySet | back to summary |
---|---|
public final void lazySet(V newValue) Sets the value to
|
set | back to summary |
---|---|
public final void set(V newValue) Sets the value to
|
setOpaque | back to summary |
---|---|
public final void setOpaque(V newValue) Sets the value to
|
setPlain | back to summary |
---|---|
public final void setPlain(V newValue) Sets the value to
|
setRelease | back to summary |
---|---|
public final void setRelease(V newValue) Sets the value to
|
toString | back to summary |
---|---|
public String toString() Overrides java. Returns the String representation of the current value.
|
updateAndGet | back to summary |
---|---|
public final V updateAndGet(UnaryOperator<V> updateFunction) Atomically updates (with memory effects as specified by
|
weakCompareAndSet | back to summary |
---|---|
public final boolean weakCompareAndSet(V expectedValue, V newValue)
Deprecated since 9. This method has plain memory effects but the method
name implies volatile memory effects (see methods such as
Possibly atomically sets the value to
|
weakCompareAndSetAcquire | back to summary |
---|---|
public final boolean weakCompareAndSetAcquire(V expectedValue, V newValue) Possibly atomically sets the value to
|
weakCompareAndSetPlain | back to summary |
---|---|
public final boolean weakCompareAndSetPlain(V expectedValue, V newValue) Possibly atomically sets the value to
|
weakCompareAndSetRelease | back to summary |
---|---|
public final boolean weakCompareAndSetRelease(V expectedValue, V newValue) Possibly atomically sets the value to
|
weakCompareAndSetVolatile | back to summary |
---|---|
public final boolean weakCompareAndSetVolatile(V expectedValue, V newValue) Possibly atomically sets the value to
|