public class AtomixValue extends Object implements AsyncAtomicValue<String>
AsyncAtomicValue backed by AtomixConsistentMap.DistributedPrimitive.Status, DistributedPrimitive.TypeDEFAULT_OPERTATION_TIMEOUT_MILLIS| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
addListener(AtomicValueEventListener<String> listener)
Registers the specified listener to be notified whenever the atomic value is updated.
|
CompletableFuture<Boolean> |
compareAndSet(String expect,
String update)
Atomically sets the value to the given updated value if the current value is equal to the expected value.
|
CompletableFuture<String> |
get()
Gets the current value.
|
CompletableFuture<String> |
getAndSet(String value)
Atomically sets to the given value and returns the old value.
|
String |
name()
Returns the name of this primitive.
|
CompletableFuture<Void> |
removeListener(AtomicValueEventListener<String> listener)
Unregisters the specified listener such that it will no longer
receive atomic value update notifications.
|
CompletableFuture<Void> |
set(String value)
Sets to the given value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasAtomicValue, asAtomicValue, primitiveTypeaddStatusChangeListener, applicationId, destroy, removeStatusChangeListener, statusChangeListenerspublic CompletableFuture<Boolean> compareAndSet(String expect, String update)
AsyncAtomicValueIMPORTANT: Equality is based on the equality of the serialized {code byte[]} representations.
compareAndSet in interface AsyncAtomicValue<String>expect - the expected valueupdate - the new valuetrue if update was successful. Otherwise future
will be completed with a value of falsepublic CompletableFuture<String> get()
AsyncAtomicValueget in interface AsyncAtomicValue<String>public CompletableFuture<String> getAndSet(String value)
AsyncAtomicValuegetAndSet in interface AsyncAtomicValue<String>value - the new valuepublic CompletableFuture<Void> set(String value)
AsyncAtomicValueset in interface AsyncAtomicValue<String>value - value to setpublic CompletableFuture<Void> addListener(AtomicValueEventListener<String> listener)
AsyncAtomicValueaddListener in interface AsyncAtomicValue<String>listener - listener to notify about eventspublic CompletableFuture<Void> removeListener(AtomicValueEventListener<String> listener)
AsyncAtomicValueremoveListener in interface AsyncAtomicValue<String>listener - listener to unregisterpublic String name()
DistributedPrimitivename in interface DistributedPrimitive