public interface AsyncAtomicCounterMap<K> extends DistributedPrimitive
DistributedPrimitive.Status, DistributedPrimitive.Type
DEFAULT_OPERATION_TIMEOUT_MILLIS
Modifier and Type | Method and Description |
---|---|
CompletableFuture<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. |
CompletableFuture<Void> |
clear()
Removes all entries from the map.
|
CompletableFuture<Long> |
decrementAndGet(K key)
Decrements by one the value currently associated with key, and returns the new value.
|
CompletableFuture<Long> |
get(K key)
Returns the value associated with key, or zero if there is no value associated with key.
|
CompletableFuture<Long> |
getAndAdd(K key,
long delta)
Adds delta to the value currently associated with key, and returns the old value.
|
CompletableFuture<Long> |
getAndDecrement(K key)
Decrements by one the value currently associated with key, and returns the old value.
|
CompletableFuture<Long> |
getAndIncrement(K key)
Increments by one the value currently associated with key, and returns the old value.
|
CompletableFuture<Long> |
incrementAndGet(K key)
Increments by one the value currently associated with key, and returns the new value.
|
CompletableFuture<Boolean> |
isEmpty()
Returns a boolean indicating whether the map is empty.
|
default DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
CompletableFuture<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.
|
CompletableFuture<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.
|
CompletableFuture<Long> |
remove(K key)
Removes and returns the value associated with key.
|
CompletableFuture<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.
|
CompletableFuture<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.
|
CompletableFuture<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
CompletableFuture<Long> incrementAndGet(K key)
key
- key with which the specified value is to be associatedCompletableFuture<Long> decrementAndGet(K key)
key
- key with which the specified value is to be associatedCompletableFuture<Long> getAndIncrement(K key)
key
- key with which the specified value is to be associatedCompletableFuture<Long> getAndDecrement(K key)
key
- key with which the specified value is to be associatedCompletableFuture<Long> addAndGet(K key, long delta)
key
- key with which the specified value is to be associateddelta
- the value to addCompletableFuture<Long> getAndAdd(K key, long delta)
key
- key with which the specified value is to be associateddelta
- the value to addCompletableFuture<Long> get(K key)
key
- key with which the specified value is to be associatedCompletableFuture<Long> put(K key, long newValue)
key
- key with which the specified value is to be associatednewValue
- the value to putCompletableFuture<Long> putIfAbsent(K key, long newValue)
key
- key with which the specified value is to be associatednewValue
- the value to putCompletableFuture<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 replaceCompletableFuture<Long> remove(K key)
key
- key with which the specified value is to be associatedCompletableFuture<Boolean> remove(K key, long value)
key
- key with which the specified value is to be associatedvalue
- the value to removeCompletableFuture<Integer> size()
CompletableFuture<Boolean> isEmpty()
CompletableFuture<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