V
- value typepublic interface AtomicValue<V> extends DistributedPrimitive
DistributedPrimitive.Status, DistributedPrimitive.Type
DEFAULT_OPERATION_TIMEOUT_MILLIS, DEFAULT_OPERTATION_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.
|
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.
|
default DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
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.
|
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
default DistributedPrimitive.Type primitiveType()
DistributedPrimitive
primitiveType
in interface DistributedPrimitive
boolean 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 unregister