Package io.atomix.client.value
Interface AsyncAtomicValue<V>
- Type Parameters:
V- value type
- All Superinterfaces:
AsyncPrimitive,DistributedPrimitive
-
Field Summary
Fields inherited from interface io.atomix.client.DistributedPrimitive
DEFAULT_OPERATION_TIMEOUT_MILLIS -
Method Summary
Modifier and TypeMethodDescriptionget()Gets the current value.default CompletableFuture<Cancellable>listen(AtomicValueEventListener<V> listener) Registers the specified listener to be notified whenever the atomic value is updated.listen(AtomicValueEventListener<V> listener, Executor executor) Registers the specified listener to be notified whenever the atomic value is updated.Sets to the given value.Sets to the given value.default AtomicValue<V>sync()Returns a synchronous wrapper around the asynchronous primitive.Returns a synchronous wrapper around the asynchronous primitive.Methods inherited from interface io.atomix.client.AsyncPrimitive
closeMethods inherited from interface io.atomix.client.DistributedPrimitive
name
-
Method Details
-
get
CompletableFuture<Versioned<V>> get()Gets the current value.- Returns:
- current value
-
set
Sets to the given value.- Parameters:
value- new value- Returns:
- previous versioned value
-
set
Sets to the given value.- Parameters:
value- new value- Returns:
- previous versioned value
-
listen
Registers the specified listener to be notified whenever the atomic value is updated.- Parameters:
listener- listener to notify about events- Returns:
- CompletableFuture that will be completed when the operation finishes
-
listen
Registers the specified listener to be notified whenever the atomic value is updated.- Parameters:
listener- listener to notify about events- Returns:
- CompletableFuture that will be completed when the operation finishes
-
sync
Description copied from interface:AsyncPrimitiveReturns a synchronous wrapper around the asynchronous primitive.- Specified by:
syncin interfaceAsyncPrimitive- Returns:
- the synchronous primitive
-
sync
Description copied from interface:AsyncPrimitiveReturns a synchronous wrapper around the asynchronous primitive.- Specified by:
syncin interfaceAsyncPrimitive- Parameters:
operationTimeout- the synchronous operation timeout- Returns:
- the synchronous primitive
-