Package io.atomix.client.value
Interface AsyncAtomicValue<V>
- Type Parameters:
V- value type
- All Superinterfaces:
AsyncPrimitive<AsyncAtomicValue<V>,,AtomicValue<V>> DistributedPrimitive
-
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>Returns a synchronous wrapper around the asynchronous primitive.Methods inherited from interface io.atomix.client.AsyncPrimitive
close, syncMethods 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<AsyncAtomicValue<V>,AtomicValue<V>> - Parameters:
operationTimeout- the synchronous operation timeout- Returns:
- the synchronous primitive
-