public enum TerminalAtomicsHelper extends java.lang.Enum<TerminalAtomicsHelper>
| Modifier and Type | Method and Description |
|---|---|
static <U> boolean |
add(java.util.concurrent.atomic.AtomicReference<U[]> instance,
U newValue,
U[] terminalValue,
IntFunction<U[]> arraySupplier)
Atomically replaces the array in instance with a new array that contains the newValue as well
or returns false if the instance holds the terminalValue.
|
static <T,U> boolean |
add(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U[]> updater,
T instance,
U newValue,
U[] terminalValue,
IntFunction<U[]> arraySupplier)
Atomically replaces the array in instance with a new array that contains the newValue as well
or returns false if the instance holds the terminalValue.
|
static <U> boolean |
remove(java.util.concurrent.atomic.AtomicReference<U[]> reference,
U value,
U[] terminalValue,
U[] zeroArray,
IntFunction<U[]> arraySupplier)
Atomically replaces the array in instance with a new array that doesn't contain the
given value or returns false if the instance holds the terminal state or an empty array
or the value is not in the array.
|
static <T,U> boolean |
remove(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U[]> updater,
T instance,
U value,
U[] terminalValue,
U[] zeroArray,
IntFunction<U[]> arraySupplier)
Atomically replaces the array in instance with a new array that doesn't contain the
given value or returns false if the instance holds the terminal state or an empty array
or the value is not in the array.
|
static <T,U> boolean |
set(java.util.concurrent.atomic.AtomicReference<U> instance,
U newValue,
U terminalValue,
Consumer<? super U> onTerminate)
Atomically replaces the contents of the instance and calls the callback with the old value
or calls the callback with the new value if the instance holds the terminal value.
|
static <T,U> boolean |
set(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U> updater,
T instance,
U newValue,
U terminalValue,
Consumer<? super U> onTerminate)
Atomically replaces the contents of the instance and calls the callback with the old value
or calls the callback with the new value if the instance holds the terminal value.
|
static <U> U |
terminate(java.util.concurrent.atomic.AtomicReference<U> instance,
U terminalValue)
Atomically swaps in the terminal value and returns the previous value.
|
static <U> void |
terminate(java.util.concurrent.atomic.AtomicReference<U> instance,
U terminalValue,
Consumer<? super U> onTerminate)
Atomically swaps in the terminalValue and calls the given callback if not already terminated.
|
static <T,U> U |
terminate(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U> updater,
T instance,
U terminalValue)
Atomically swaps in the terminal value and returns the previous value.
|
static <T,U> void |
terminate(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U> updater,
T instance,
U terminalValue,
Consumer<? super U> onTerminate)
Atomically swaps in the terminalValue and calls the given callback if not already terminated.
|
static <T,U> boolean |
update(java.util.concurrent.atomic.AtomicReference<U> instance,
U newValue,
U terminalValue,
Consumer<? super U> onTerminate)
Atomically replaces the content of the instance but calls the callback only if the instance holds
the terminal value.
|
static <T,U> boolean |
update(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U> updater,
T instance,
U newValue,
U terminalValue,
Consumer<? super U> onTerminate)
Atomically replaces the content of the instance but calls the callback only if the instance holds
the terminal value.
|
static TerminalAtomicsHelper |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static TerminalAtomicsHelper[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static TerminalAtomicsHelper[] values()
for (TerminalAtomicsHelper c : TerminalAtomicsHelper.values()) System.out.println(c);
public static TerminalAtomicsHelper valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic static <T,U> void terminate(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U> updater,
T instance,
U terminalValue,
Consumer<? super U> onTerminate)
T - the instance typeU - the reference typeupdater - instance - terminalValue - onTerminate - public static <U> void terminate(java.util.concurrent.atomic.AtomicReference<U> instance,
U terminalValue,
Consumer<? super U> onTerminate)
U - the reference typeinstance - terminalValue - onTerminate - public static <T,U> U terminate(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U> updater,
T instance,
U terminalValue)
T - the instance typeU - the reference typeupdater - instance - terminalValue - public static <U> U terminate(java.util.concurrent.atomic.AtomicReference<U> instance,
U terminalValue)
U - the reference typeinstance - terminalValue - public static <T,U> boolean set(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U> updater,
T instance,
U newValue,
U terminalValue,
Consumer<? super U> onTerminate)
T - the instance typeU - the reference typeupdater - instance - newValue - terminalValue - onTerminate - update(AtomicReferenceFieldUpdater, Object, Object, Object, Consumer)public static <T,U> boolean set(java.util.concurrent.atomic.AtomicReference<U> instance,
U newValue,
U terminalValue,
Consumer<? super U> onTerminate)
T - the instance typeU - the reference typeinstance - newValue - terminalValue - onTerminate - update(AtomicReference, Object, Object, Consumer)public static <T,U> boolean update(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U> updater,
T instance,
U newValue,
U terminalValue,
Consumer<? super U> onTerminate)
T - the instance typeU - the reference typeupdater - instance - newValue - terminalValue - onTerminate - set(AtomicReferenceFieldUpdater, Object, Object, Object, Consumer)public static <T,U> boolean update(java.util.concurrent.atomic.AtomicReference<U> instance,
U newValue,
U terminalValue,
Consumer<? super U> onTerminate)
T - the instance typeU - the reference typeinstance - newValue - terminalValue - onTerminate - set(AtomicReference, Object, Object, Consumer)public static <T,U> boolean add(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U[]> updater,
T instance,
U newValue,
U[] terminalValue,
IntFunction<U[]> arraySupplier)
T - the instance typeU - the reference typeupdater - instance - newValue - terminalValue - arraySupplier - public static <U> boolean add(java.util.concurrent.atomic.AtomicReference<U[]> instance,
U newValue,
U[] terminalValue,
IntFunction<U[]> arraySupplier)
U - the reference typeinstance - newValue - terminalValue - arraySupplier - public static <T,U> boolean remove(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<T,U[]> updater,
T instance,
U value,
U[] terminalValue,
U[] zeroArray,
IntFunction<U[]> arraySupplier)
T - the instance typeU - the reference typeupdater - instance - value - terminalValue - zeroArray - arraySupplier - public static <U> boolean remove(java.util.concurrent.atomic.AtomicReference<U[]> reference,
U value,
U[] terminalValue,
U[] zeroArray,
IntFunction<U[]> arraySupplier)
U - the reference typereference - value - terminalValue - zeroArray - arraySupplier -