V - value typepublic interface AtomicValue<V> extends SyncPrimitive
DEFAULT_OPERATION_TIMEOUT_MILLIS| Modifier and Type | Method and Description |
|---|---|
void |
addListener(AtomicValueEventListener<V> listener)
Registers the specified listener to be notified whenever the atomic value is updated.
|
AsyncAtomicValue<V> |
async()
Returns the underlying asynchronous primitive.
|
boolean |
compareAndSet(V expect,
V update)
Atomically sets the value to the given updated value if the current value is equal to the expected value.
|
V |
get()
Gets the current value.
|
V |
getAndSet(V value)
Atomically sets to the given value and returns the old value.
|
void |
removeListener(AtomicValueEventListener<V> listener)
Unregisters the specified listener such that it will no longer
receive atomic value update notifications.
|
void |
set(V value)
Sets to the given value.
|
close, deleteaddStateChangeListener, name, protocol, removeStateChangeListener, typeboolean compareAndSet(V expect, V update)
IMPORTANT: Equality is based on the equality of the serialized byte[] representations.
expect - the expected valueupdate - the new valueV get()
V getAndSet(V value)
value - the new valuevoid set(V value)
value - new valuevoid addListener(AtomicValueEventListener<V> listener)
listener - listener to notify about eventsvoid removeListener(AtomicValueEventListener<V> listener)
listener - listener to unregisterAsyncAtomicValue<V> async()
SyncPrimitiveasync in interface SyncPrimitiveCopyright © 2013–2018. All rights reserved.