public interface AsyncAtomicCounter extends DistributedPrimitive
DistributedPrimitive.Status, DistributedPrimitive.Type
DEFAULT_OPERATION_TIMEOUT_MILLIS, DEFAULT_OPERTATION_TIMEOUT_MILLIS
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<java.lang.Long> |
addAndGet(long delta)
Atomically adds the given value to the current value.
|
default AtomicCounter |
asAtomicCounter()
Returns a new
AtomicCounter that is backed by this instance and with a default operation timeout. |
default AtomicCounter |
asAtomicCounter(long timeoutMillis)
Returns a new
AtomicCounter that is backed by this instance. |
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
compareAndSet(long expectedValue,
long updateValue)
Atomically sets the given counter to the updated value if the current value is the expected value, otherwise
no change occurs.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
get()
Returns the current value of the counter without modifying it.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
getAndAdd(long delta)
Atomically adds the given value to the current value.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
getAndIncrement()
Atomically increment by one the current value.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
incrementAndGet()
Atomically increment by one the current value.
|
default DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
set(long value)
Atomically sets the given value to the current value.
|
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
default DistributedPrimitive.Type primitiveType()
DistributedPrimitive
primitiveType
in interface DistributedPrimitive
java.util.concurrent.CompletableFuture<java.lang.Long> incrementAndGet()
java.util.concurrent.CompletableFuture<java.lang.Long> getAndIncrement()
java.util.concurrent.CompletableFuture<java.lang.Long> getAndAdd(long delta)
delta
- the value to addjava.util.concurrent.CompletableFuture<java.lang.Long> addAndGet(long delta)
delta
- the value to addjava.util.concurrent.CompletableFuture<java.lang.Long> get()
java.util.concurrent.CompletableFuture<java.lang.Void> set(long value)
value
- new valuejava.util.concurrent.CompletableFuture<java.lang.Boolean> compareAndSet(long expectedValue, long updateValue)
expectedValue
- the expected current value of the counterupdateValue
- the new value to be setdefault AtomicCounter asAtomicCounter(long timeoutMillis)
AtomicCounter
that is backed by this instance.timeoutMillis
- timeout duration for the returned ConsistentMap operationsConsistentMap
instancedefault AtomicCounter asAtomicCounter()
AtomicCounter
that is backed by this instance and with a default operation timeout.ConsistentMap
instance