Class AsyncLocalAtomicBoolean
java.lang.Object
com.oracle.coherence.concurrent.atomic.AsyncLocalAtomicBoolean
- All Implemented Interfaces:
AsyncAtomicBoolean
Local implementation of
AsyncAtomicBoolean interface,
that simply wraps java.util.concurrent.atomic.AtomicBoolean
instance and returns an already completed future from each method.- Author:
- Aleks Seovic 2020.12.07
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructLocalAtomicBooleaninstance. -
Method Summary
Modifier and TypeMethodDescriptioncompareAndExchange(boolean fExpectedValue, boolean fNewValue) Atomically sets the value tonewValueif the current value, referred to as the witness value,== expectedValue.compareAndSet(boolean fExpectedValue, boolean fNewValue) Atomically sets the value tonewValueif the current value== expectedValue.get()Returns the current value.getAndSet(boolean fNewValue) Atomically sets the value tonewValueand returns the old value.set(boolean fNewValue) Sets the value tonewValue.toString()Returns the String representation of the current value.
-
Field Details
-
f_fValue
Wrapped atomic boolean value.
-
-
Constructor Details
-
AsyncLocalAtomicBoolean
ConstructLocalAtomicBooleaninstance.- Parameters:
value- wrapped value
-
-
Method Details
-
get
Description copied from interface:AsyncAtomicBooleanReturns the current value.- Specified by:
getin interfaceAsyncAtomicBoolean- Returns:
- the current value
-
set
Description copied from interface:AsyncAtomicBooleanSets the value tonewValue.- Specified by:
setin interfaceAsyncAtomicBoolean- Parameters:
fNewValue- the new value- Returns:
- a
CompletableFuturethat can be used to determine whether the operation completed
-
getAndSet
Description copied from interface:AsyncAtomicBooleanAtomically sets the value tonewValueand returns the old value.- Specified by:
getAndSetin interfaceAsyncAtomicBoolean- Parameters:
fNewValue- the new value- Returns:
- the previous value
-
compareAndSet
Description copied from interface:AsyncAtomicBooleanAtomically sets the value tonewValueif the current value== expectedValue.- Specified by:
compareAndSetin interfaceAsyncAtomicBoolean- Parameters:
fExpectedValue- the expected valuefNewValue- the new value- Returns:
trueif successful. False return indicates that the actual value was not equal to the expected value.
-
compareAndExchange
Description copied from interface:AsyncAtomicBooleanAtomically sets the value tonewValueif the current value, referred to as the witness value,== expectedValue.- Specified by:
compareAndExchangein interfaceAsyncAtomicBoolean- Parameters:
fExpectedValue- the expected valuefNewValue- the new value- Returns:
- the witness value, which will be the same as the expected value if successful
-
toString
Returns the String representation of the current value.
-