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
-
Constructor Summary
ModifierConstructorDescriptionprotected
ConstructLocalAtomicBoolean
instance. -
Method Summary
Modifier and TypeMethodDescriptioncompareAndExchange
(boolean fExpectedValue, boolean fNewValue) Atomically sets the value tonewValue
if the current value, referred to as the witness value,== expectedValue
.compareAndSet
(boolean fExpectedValue, boolean fNewValue) Atomically sets the value tonewValue
if the current value== expectedValue
.get()
Returns the current value.getAndSet
(boolean fNewValue) Atomically sets the value tonewValue
and 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
ConstructLocalAtomicBoolean
instance.- Parameters:
value
- wrapped value
-
-
Method Details
-
get
Description copied from interface:AsyncAtomicBoolean
Returns the current value.- Specified by:
get
in interfaceAsyncAtomicBoolean
- Returns:
- the current value
-
set
Description copied from interface:AsyncAtomicBoolean
Sets the value tonewValue
.- Specified by:
set
in interfaceAsyncAtomicBoolean
- Parameters:
fNewValue
- the new value- Returns:
- a
CompletableFuture
that can be used to determine whether the operation completed
-
getAndSet
Description copied from interface:AsyncAtomicBoolean
Atomically sets the value tonewValue
and returns the old value.- Specified by:
getAndSet
in interfaceAsyncAtomicBoolean
- Parameters:
fNewValue
- the new value- Returns:
- the previous value
-
compareAndSet
Description copied from interface:AsyncAtomicBoolean
Atomically sets the value tonewValue
if the current value== expectedValue
.- Specified by:
compareAndSet
in interfaceAsyncAtomicBoolean
- Parameters:
fExpectedValue
- the expected valuefNewValue
- the new value- Returns:
true
if successful. False return indicates that the actual value was not equal to the expected value.
-
compareAndExchange
Description copied from interface:AsyncAtomicBoolean
Atomically sets the value tonewValue
if the current value, referred to as the witness value,== expectedValue
.- Specified by:
compareAndExchange
in 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.
-