public interface WeakCounter
This interface represents a weak counter in the way that the write operations does not return a consistent results.
In this way, all the writes return a CompletableFuture.
Note: the reset operation is not atomic.
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
add(long delta)
Adds the given value to the new value.
|
<T extends CounterListener> |
addListener(T listener)
Adds a
CounterListener to this counter. |
default CompletableFuture<Void> |
decrement()
Decrements the counter.
|
CounterConfiguration |
getConfiguration() |
String |
getName() |
long |
getValue()
It returns the counter's value.
|
default CompletableFuture<Void> |
increment()
Increments the counter.
|
CompletableFuture<Void> |
remove()
It removes this counter from the cluster.
|
CompletableFuture<Void> |
reset()
Resets the counter to its initial value.
|
SyncWeakCounter |
sync()
It returns a synchronous weak counter for this instance.
|
String getName()
long getValue()
This value may be not the mot up-to-data value.
default CompletableFuture<Void> increment()
default CompletableFuture<Void> decrement()
CompletableFuture<Void> add(long delta)
delta - the value to add.CompletableFuture<Void> reset()
<T extends CounterListener> Handle<T> addListener(T listener)
CounterListener to this counter.T - The type of the listener. It must implement CounterListener.listener - The listener to add.Handle that allows to remove the listener via Handle.remove() ()}.CounterConfiguration getConfiguration()
CounterConfiguration used by this counter.CompletableFuture<Void> remove()
Note that it doesn't remove the counter from the CounterManager. If you want to remove the counter from
the CounterManager use CounterManager.remove(String).
CompletableFuture that is completed when the counter is removed from the cluster.SyncWeakCounter sync()
SyncWeakCounter.Copyright © 2020 JBoss, a division of Red Hat. All rights reserved.