Class AsyncRemoteAtomicBoolean
- java.lang.Object
- 
- com.oracle.coherence.concurrent.atomic.AsyncRemoteAtomicBoolean
 
- 
- All Implemented Interfaces:
- AsyncAtomicBoolean
 
 public class AsyncRemoteAtomicBoolean extends Object implements AsyncAtomicBoolean The remote implementation ofAsyncAtomicBoolean, backed by a CoherenceNamedMapentry.Every method in this class is guaranteed to execute effectively-once, and provides cluster-wide atomicity guarantees for the backing atomic value. However, keep in mind that this comes at a significant cost -- each method invocation results in a network call to a remote owner of the backing atomic value, which means that each operation has significantly higher latency than a corresponding localimplementation.- Since:
- 21.12
- Author:
- Aleks Seovic 2020.12.07
 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedAsyncRemoteAtomicBoolean(AsyncNamedMap<String,AtomicBoolean> mapAtomic, String sName)Constructs a newAsyncRemoteAtomicBoolean.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Boolean>compareAndExchange(boolean fExpectedValue, boolean fNewValue)Atomically sets the value tonewValueif the current value, referred to as the witness value,== expectedValue.CompletableFuture<Boolean>compareAndSet(boolean fExpectedValue, boolean fNewValue)Atomically sets the value tonewValueif the current value== expectedValue.CompletableFuture<Boolean>get()Returns the current value.CompletableFuture<Boolean>getAndSet(boolean fNewValue)Atomically sets the value tonewValueand returns the old value.protected <R> CompletableFuture<R>invoke(Remote.Function<AtomicBoolean,R> function)Apply specified function against the remote object and return the result.protected <R> CompletableFuture<R>invoke(Remote.Function<AtomicBoolean,R> function, boolean fMutate)Apply specified function against the remote object and return the result.CompletableFuture<Void>set(boolean fNewValue)Sets the value tonewValue.StringtoString()Returns the String representation of the current value.
 
- 
- 
- 
Constructor Detail- 
AsyncRemoteAtomicBooleanprotected AsyncRemoteAtomicBoolean(AsyncNamedMap<String,AtomicBoolean> mapAtomic, String sName) Constructs a newAsyncRemoteAtomicBoolean.- Parameters:
- mapAtomic- the map that holds this atomic value
- sName- the name of this atomic value
 
 
- 
 - 
Method Detail- 
getpublic CompletableFuture<Boolean> get() Description copied from interface:AsyncAtomicBooleanReturns the current value.- Specified by:
- getin interface- AsyncAtomicBoolean
- Returns:
- the current value
 
 - 
setpublic CompletableFuture<Void> set(boolean fNewValue) Description copied from interface:AsyncAtomicBooleanSets the value tonewValue.- Specified by:
- setin interface- AsyncAtomicBoolean
- Parameters:
- fNewValue- the new value
- Returns:
- a CompletableFuturethat can be used to determine whether the operation completed
 
 - 
getAndSetpublic CompletableFuture<Boolean> getAndSet(boolean fNewValue) Description copied from interface:AsyncAtomicBooleanAtomically sets the value tonewValueand returns the old value.- Specified by:
- getAndSetin interface- AsyncAtomicBoolean
- Parameters:
- fNewValue- the new value
- Returns:
- the previous value
 
 - 
compareAndSetpublic CompletableFuture<Boolean> compareAndSet(boolean fExpectedValue, boolean fNewValue) Description copied from interface:AsyncAtomicBooleanAtomically sets the value tonewValueif the current value== expectedValue.- Specified by:
- compareAndSetin interface- AsyncAtomicBoolean
- Parameters:
- fExpectedValue- the expected value
- fNewValue- the new value
- Returns:
- trueif successful. False return indicates that the actual value was not equal to the expected value.
 
 - 
compareAndExchangepublic CompletableFuture<Boolean> compareAndExchange(boolean fExpectedValue, boolean fNewValue) Description copied from interface:AsyncAtomicBooleanAtomically sets the value tonewValueif the current value, referred to as the witness value,== expectedValue.- Specified by:
- compareAndExchangein interface- AsyncAtomicBoolean
- Parameters:
- fExpectedValue- the expected value
- fNewValue- the new value
- Returns:
- the witness value, which will be the same as the expected value if successful
 
 - 
toStringpublic String toString() Returns the String representation of the current value.
 - 
invokeprotected <R> CompletableFuture<R> invoke(Remote.Function<AtomicBoolean,R> function) Apply specified function against the remote object and return the result.Any changes the function makes to the remote object will be preserved. - Type Parameters:
- R- the type of the result
- Parameters:
- function- the function to apply
- Returns:
- the result of the function applied to a remote object
 
 - 
invokeprotected <R> CompletableFuture<R> invoke(Remote.Function<AtomicBoolean,R> function, boolean fMutate) Apply specified function against the remote object and return the result.If the fMutateargument istrue, any changes to the remote object will be preserved.- Type Parameters:
- R- the type of the result
- Parameters:
- function- the function to apply
- fMutate- flag specifying whether the function mutates the object
- Returns:
- the result of the function applied to a remote object
 
 
- 
 
-