Class AtomicEnum<T extends Enum<T>>
- java.lang.Object
-
- com.oracle.coherence.concurrent.executor.atomic.AtomicEnum<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompareAndSet(T expect, T newValue)Atomically sets the value to the new value if the current value == the expected value.booleanequals(Object o)Tget()Gets the current value.TgetAndSet(T newValue)Atomically sets theAtomicEnumto the given new value and returns the previous value.inthashCode()static <T extends Enum<T>>
AtomicEnum<T>of(T value)Constructs anAtomicEnumgiven aEnumvalue.voidset(T value)Sets theAtomicEnumto the new value.StringtoString()
-
-
-
Method Detail
-
compareAndSet
public boolean compareAndSet(T expect, T newValue)
Atomically sets the value to the new value if the current value == the expected value.- Parameters:
expect- the expected valuenewValue- the new value- Returns:
trueif successfulfalseindicates that the current value was not equal to the expected value.
-
get
public T get()
Gets the current value.- Returns:
- the current value
-
getAndSet
public T getAndSet(T newValue)
Atomically sets theAtomicEnumto the given new value and returns the previous value.- Parameters:
newValue- the new value- Returns:
- the previous value
-
set
public void set(T value)
Sets theAtomicEnumto the new value.- Parameters:
value- the new value
-
of
public static <T extends Enum<T>> AtomicEnum<T> of(T value)
Constructs anAtomicEnumgiven aEnumvalue.- Type Parameters:
T- the type of theEnum- Parameters:
value- theEnumvalue (may benull)- Returns:
- the
AtomicEnum
-
-