|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.concurrent.atomic.AtomicReference<V>
com.atlassian.util.concurrent.atomic.AtomicReference<V>
public class AtomicReference<V>
AtomicReference with richer functionality. This class implements commonly
implemented patterns of use of compareAndSet such as
#getAndSetIf(Object, Object)
and update(Function)
.
Constructor Summary | |
---|---|
AtomicReference()
Creates a new AtomicReference with null initial value. |
|
AtomicReference(V initialValue)
Creates a new AtomicReference with the given initial value. |
Method Summary | |
---|---|
V |
getOrSetAndGetIf(V oldValue,
com.google.common.base.Supplier<V> newValue)
Check the current value and if it matches the old value argument, set it to the one created by the new value supplier and return
that instead. |
V |
getOrSetAndGetIf(V oldValue,
V newValue)
Check the current value and if it matches the old value argument, set it to the new value and return that instead. |
V |
update(com.google.common.base.Function<V,V> newValueFactory)
Do the actual update. |
Methods inherited from class java.util.concurrent.atomic.AtomicReference |
---|
compareAndSet, get, getAndSet, lazySet, set, toString, weakCompareAndSet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AtomicReference()
public AtomicReference(V initialValue)
initialValue
- the initial valueMethod Detail |
---|
public final V getOrSetAndGetIf(V oldValue, com.google.common.base.Supplier<V> newValue)
new value supplier
and return
that instead. If the old value argument does not match, ignore both and
just return the current value.
T
- the object type.oldValue
- to check the current value against (reference equality
check only).newValue
- a Supplier
for a new value. May be called more
than once.
public final V getOrSetAndGetIf(V oldValue, V newValue)
T
- the object type.oldValue
- to check the current value against (reference equality
check only)newValue
- the new value to set it to
public final V update(com.google.common.base.Function<V,V> newValueFactory)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |