public class AtomixAtomicCounterMap extends io.atomix.resource.AbstractResource<AtomixAtomicCounterMap> implements AsyncAtomicCounterMap<String>
AsyncAtomicCounterMap implementation backed by Atomix.DistributedPrimitive.Status, DistributedPrimitive.TypeDEFAULT_OPERTATION_TIMEOUT_MILLIS| Constructor and Description |
|---|
AtomixAtomicCounterMap(io.atomix.copycat.client.CopycatClient client,
Properties options) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Long> |
addAndGet(String 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(String key)
Decrements by one the value currently associated with key, and returns the new value.
|
CompletableFuture<Long> |
get(String key)
Returns the value associated with key, or zero if there is no value associated with key.
|
CompletableFuture<Long> |
getAndAdd(String key,
long delta)
Adds delta to the value currently associated with key, and returns the old value.
|
CompletableFuture<Long> |
getAndDecrement(String key)
Decrements by one the value currently associated with key, and returns the old value.
|
CompletableFuture<Long> |
getAndIncrement(String key)
Increments by one the value currently associated with key, and returns the old value.
|
CompletableFuture<Long> |
incrementAndGet(String 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.
|
String |
name()
Returns the name of this primitive.
|
CompletableFuture<Long> |
put(String 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(String 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(String key)
Removes and returns the value associated with key.
|
CompletableFuture<Boolean> |
remove(String 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(String 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.
|
close, config, context, delete, equals, hashCode, isClosed, isOpen, onEvent, onRecovery, onStateChange, open, options, recover, serializer, state, toString, typeclone, finalize, getClass, notify, notifyAll, wait, wait, waitasAtomicCounterMap, asAtomicCounterMap, primitiveTypeaddStatusChangeListener, applicationId, destroy, removeStatusChangeListener, statusChangeListenerspublic AtomixAtomicCounterMap(io.atomix.copycat.client.CopycatClient client,
Properties options)
public String name()
DistributedPrimitivename in interface DistributedPrimitivepublic CompletableFuture<Long> incrementAndGet(String key)
AsyncAtomicCounterMapincrementAndGet in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatedpublic CompletableFuture<Long> decrementAndGet(String key)
AsyncAtomicCounterMapdecrementAndGet in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatedpublic CompletableFuture<Long> getAndIncrement(String key)
AsyncAtomicCounterMapgetAndIncrement in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatedpublic CompletableFuture<Long> getAndDecrement(String key)
AsyncAtomicCounterMapgetAndDecrement in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatedpublic CompletableFuture<Long> addAndGet(String key, long delta)
AsyncAtomicCounterMapaddAndGet in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associateddelta - the value to addpublic CompletableFuture<Long> getAndAdd(String key, long delta)
AsyncAtomicCounterMapgetAndAdd in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associateddelta - the value to addpublic CompletableFuture<Long> get(String key)
AsyncAtomicCounterMapget in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatedpublic CompletableFuture<Long> put(String key, long newValue)
AsyncAtomicCounterMapput in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatednewValue - the value to putpublic CompletableFuture<Long> putIfAbsent(String key, long newValue)
AsyncAtomicCounterMapputIfAbsent in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatednewValue - the value to putpublic CompletableFuture<Boolean> replace(String key, long expectedOldValue, long newValue)
AsyncAtomicCounterMapreplace in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatedexpectedOldValue - the expected valuenewValue - the value to replacepublic CompletableFuture<Long> remove(String key)
AsyncAtomicCounterMapremove in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatedpublic CompletableFuture<Boolean> remove(String key, long value)
AsyncAtomicCounterMapremove in interface AsyncAtomicCounterMap<String>key - key with which the specified value is to be associatedvalue - the value to removepublic CompletableFuture<Integer> size()
AsyncAtomicCounterMapsize in interface AsyncAtomicCounterMap<String>public CompletableFuture<Boolean> isEmpty()
AsyncAtomicCounterMapisEmpty in interface AsyncAtomicCounterMap<String>public CompletableFuture<Void> clear()
AsyncAtomicCounterMapclear in interface AsyncAtomicCounterMap<String>