public interface AsyncAtomicCounterMap<K> extends AsyncPrimitive
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.
|
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.
|
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.
|
default AtomicCounterMap<K> |
sync()
Returns a synchronous wrapper around the asynchronous primitive.
|
AtomicCounterMap<K> |
sync(Duration operationTimeout)
Returns a synchronous wrapper around the asynchronous primitive.
|
close, deleteaddStateChangeListener, name, protocol, removeStateChangeListener, typeCompletableFuture<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)
If expectedOldValue is zero, this method will succeed if (key, zero) is currently in the map, or if key is not in the map at all.
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> sync()
AsyncPrimitivesync in interface AsyncPrimitiveAtomicCounterMap<K> sync(Duration operationTimeout)
AsyncPrimitivesync in interface AsyncPrimitiveoperationTimeout - the synchronous operation timeoutCopyright © 2013–2018. All rights reserved.