Class LocalAtomicBoolean
- java.lang.Object
-
- com.oracle.coherence.concurrent.atomic.LocalAtomicBoolean
-
- All Implemented Interfaces:
AtomicBoolean
public class LocalAtomicBoolean extends Object implements AtomicBoolean
Local implementation ofAtomicBooleaninterface, that simply wrapsjava.util.concurrent.atomic.AtomicBooleaninstance.- Since:
- 21.12
- Author:
- Aleks Seovic 2020.12.07
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.oracle.coherence.concurrent.atomic.AtomicBoolean
AtomicBoolean.Serializer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLocalAtomicBoolean(boolean fValue)ConstructLocalAtomicBooleaninstance.protectedLocalAtomicBoolean(AtomicBoolean fValue)ConstructLocalAtomicBooleaninstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncLocalAtomicBooleanasync()Return non-blocking API for this atomic value.booleancompareAndExchange(boolean fExpectedValue, boolean fNewValue)Atomically sets the value tonewValueif the current value, referred to as the witness value,== expectedValue.booleancompareAndSet(boolean fExpectedValue, boolean fNewValue)Atomically sets the value tonewValueif the current value== expectedValue.booleanget()Returns the current value.booleangetAndSet(boolean fNewValue)Atomically sets the value tonewValueand returns the old value.voidset(boolean fNewValue)Sets the value tonewValue.StringtoString()
-
-
-
Constructor Detail
-
LocalAtomicBoolean
protected LocalAtomicBoolean(boolean fValue)
ConstructLocalAtomicBooleaninstance.- Parameters:
fValue- initial value
-
LocalAtomicBoolean
protected LocalAtomicBoolean(AtomicBoolean fValue)
ConstructLocalAtomicBooleaninstance.- Parameters:
fValue- wrapped value
-
-
Method Detail
-
async
public AsyncLocalAtomicBoolean async()
Description copied from interface:AtomicBooleanReturn non-blocking API for this atomic value.- Specified by:
asyncin interfaceAtomicBoolean- Returns:
- non-blocking API for this atomic value
-
get
public boolean get()
Description copied from interface:AtomicBooleanReturns the current value.- Specified by:
getin interfaceAtomicBoolean- Returns:
- the current value
-
set
public void set(boolean fNewValue)
Description copied from interface:AtomicBooleanSets the value tonewValue.- Specified by:
setin interfaceAtomicBoolean- Parameters:
fNewValue- the new value
-
getAndSet
public boolean getAndSet(boolean fNewValue)
Description copied from interface:AtomicBooleanAtomically sets the value tonewValueand returns the old value.- Specified by:
getAndSetin interfaceAtomicBoolean- Parameters:
fNewValue- the new value- Returns:
- the previous value
-
compareAndSet
public boolean compareAndSet(boolean fExpectedValue, boolean fNewValue)Description copied from interface:AtomicBooleanAtomically sets the value tonewValueif the current value== expectedValue.- Specified by:
compareAndSetin interfaceAtomicBoolean- 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
public boolean compareAndExchange(boolean fExpectedValue, boolean fNewValue)Description copied from interface:AtomicBooleanAtomically sets the value tonewValueif the current value, referred to as the witness value,== expectedValue.- Specified by:
compareAndExchangein interfaceAtomicBoolean- Parameters:
fExpectedValue- the expected valuefNewValue- the new value- Returns:
- the witness value, which will be the same as the expected value if successful
-
-