Class LocalAtomicBoolean
- java.lang.Object
-
- com.oracle.coherence.concurrent.atomic.LocalAtomicBoolean
-
- All Implemented Interfaces:
AtomicBoolean
public class LocalAtomicBoolean extends Object implements AtomicBoolean
Local implementation ofAtomicBoolean
interface, that simply wrapsjava.util.concurrent.atomic.AtomicBoolean
instance.- 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 protected
LocalAtomicBoolean(boolean fValue)
ConstructLocalAtomicBoolean
instance.protected
LocalAtomicBoolean(AtomicBoolean fValue)
ConstructLocalAtomicBoolean
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncLocalAtomicBoolean
async()
Return non-blocking API for this atomic value.boolean
compareAndExchange(boolean fExpectedValue, boolean fNewValue)
Atomically sets the value tonewValue
if the current value, referred to as the witness value,== expectedValue
.boolean
compareAndSet(boolean fExpectedValue, boolean fNewValue)
Atomically sets the value tonewValue
if the current value== expectedValue
.boolean
get()
Returns the current value.boolean
getAndSet(boolean fNewValue)
Atomically sets the value tonewValue
and returns the old value.void
set(boolean fNewValue)
Sets the value tonewValue
.String
toString()
-
-
-
Constructor Detail
-
LocalAtomicBoolean
protected LocalAtomicBoolean(boolean fValue)
ConstructLocalAtomicBoolean
instance.- Parameters:
fValue
- initial value
-
LocalAtomicBoolean
protected LocalAtomicBoolean(AtomicBoolean fValue)
ConstructLocalAtomicBoolean
instance.- Parameters:
fValue
- wrapped value
-
-
Method Detail
-
async
public AsyncLocalAtomicBoolean async()
Description copied from interface:AtomicBoolean
Return non-blocking API for this atomic value.- Specified by:
async
in interfaceAtomicBoolean
- Returns:
- non-blocking API for this atomic value
-
get
public boolean get()
Description copied from interface:AtomicBoolean
Returns the current value.- Specified by:
get
in interfaceAtomicBoolean
- Returns:
- the current value
-
set
public void set(boolean fNewValue)
Description copied from interface:AtomicBoolean
Sets the value tonewValue
.- Specified by:
set
in interfaceAtomicBoolean
- Parameters:
fNewValue
- the new value
-
getAndSet
public boolean getAndSet(boolean fNewValue)
Description copied from interface:AtomicBoolean
Atomically sets the value tonewValue
and returns the old value.- Specified by:
getAndSet
in interfaceAtomicBoolean
- Parameters:
fNewValue
- the new value- Returns:
- the previous value
-
compareAndSet
public boolean compareAndSet(boolean fExpectedValue, boolean fNewValue)
Description copied from interface:AtomicBoolean
Atomically sets the value tonewValue
if the current value== expectedValue
.- Specified by:
compareAndSet
in interfaceAtomicBoolean
- 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
public boolean compareAndExchange(boolean fExpectedValue, boolean fNewValue)
Description copied from interface:AtomicBoolean
Atomically sets the value tonewValue
if the current value, referred to as the witness value,== expectedValue
.- Specified by:
compareAndExchange
in interfaceAtomicBoolean
- Parameters:
fExpectedValue
- the expected valuefNewValue
- the new value- Returns:
- the witness value, which will be the same as the expected value if successful
-
-