public interface AsyncAtomicCounterMap<K> 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(K key,
long delta)
Adds delta to the value currently associated with key, and returns the new value.
|
default AtomicCounterMap<K> |
asAtomicCounterMap()
Returns a new
AtomicCounterMap that is backed by this instance. |
default AtomicCounterMap<K> |
asAtomicCounterMap(long timeoutMillis)
Returns a new
AtomicCounterMap that is backed by this instance. |
java.util.concurrent.CompletableFuture<java.lang.Void> |
clear()
Removes all entries from the map.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
decrementAndGet(K key)
Decrements by one the value currently associated with key, and returns the new value.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
get(K key)
Returns the value associated with key, or zero if there is no value associated with key.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
getAndAdd(K key,
long delta)
Adds delta to the value currently associated with key, and returns the old value.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
getAndDecrement(K key)
Decrements by one the value currently associated with key, and returns the old value.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
getAndIncrement(K key)
Increments by one the value currently associated with key, and returns the old value.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
incrementAndGet(K key)
Increments by one the value currently associated with key, and returns the new value.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
isEmpty()
Returns a boolean indicating whether the map is empty.
|
default DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
put(K key,
long newValue)
Associates ewValue with key in this map, and returns the value previously
associated with key, or zero if there was no such value.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
putIfAbsent(K key,
long newValue)
If key is not already associated with a value or if key is associated with
zero, associate it with newValue.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
remove(K key)
Removes and returns the value associated with key.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
remove(K key,
long value)
If (key, value) is currently in the map, this method removes it and returns
true; otherwise, this method returns false.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
replace(K key,
long expectedOldValue,
long newValue)
If (key, expectedOldValue) is currently in the map, this method replaces
expectedOldValue with newValue and returns true; otherwise, this method return false.
|
java.util.concurrent.CompletableFuture<java.lang.Integer> |
size()
Returns the number of entries in the map.
|
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
default DistributedPrimitive.Type primitiveType()
DistributedPrimitive
primitiveType
in interface DistributedPrimitive
java.util.concurrent.CompletableFuture<java.lang.Long> incrementAndGet(K key)
key
- key with which the specified value is to be associatedjava.util.concurrent.CompletableFuture<java.lang.Long> decrementAndGet(K key)
key
- key with which the specified value is to be associatedjava.util.concurrent.CompletableFuture<java.lang.Long> getAndIncrement(K key)
key
- key with which the specified value is to be associatedjava.util.concurrent.CompletableFuture<java.lang.Long> getAndDecrement(K key)
key
- key with which the specified value is to be associatedjava.util.concurrent.CompletableFuture<java.lang.Long> addAndGet(K key, long delta)
key
- key with which the specified value is to be associateddelta
- the value to addjava.util.concurrent.CompletableFuture<java.lang.Long> getAndAdd(K key, long delta)
key
- key with which the specified value is to be associateddelta
- the value to addjava.util.concurrent.CompletableFuture<java.lang.Long> get(K key)
key
- key with which the specified value is to be associatedjava.util.concurrent.CompletableFuture<java.lang.Long> put(K key, long newValue)
key
- key with which the specified value is to be associatednewValue
- the value to putjava.util.concurrent.CompletableFuture<java.lang.Long> putIfAbsent(K key, long newValue)
key
- key with which the specified value is to be associatednewValue
- the value to putjava.util.concurrent.CompletableFuture<java.lang.Boolean> replace(K key, long expectedOldValue, long newValue)
key
- key with which the specified value is to be associatedexpectedOldValue
- the expected valuenewValue
- the value to replacejava.util.concurrent.CompletableFuture<java.lang.Long> remove(K key)
key
- key with which the specified value is to be associatedjava.util.concurrent.CompletableFuture<java.lang.Boolean> remove(K key, long value)
key
- key with which the specified value is to be associatedvalue
- the value to removejava.util.concurrent.CompletableFuture<java.lang.Integer> size()
java.util.concurrent.CompletableFuture<java.lang.Boolean> isEmpty()
java.util.concurrent.CompletableFuture<java.lang.Void> clear()
default AtomicCounterMap<K> asAtomicCounterMap()
AtomicCounterMap
that is backed by this instance.AtomicCounterMap
instancedefault AtomicCounterMap<K> asAtomicCounterMap(long timeoutMillis)
AtomicCounterMap
that is backed by this instance.timeoutMillis
- timeout duration for the returned ConsistentMap operationsAtomicCounterMap
instance