public interface AtomicCounterMap<K> extends DistributedPrimitive
DistributedPrimitive.Status, DistributedPrimitive.Type
DEFAULT_OPERATION_TIMEOUT_MILLIS, DEFAULT_OPERTATION_TIMEOUT_MILLIS
Modifier and Type | Method and Description |
---|---|
long |
addAndGet(K key,
long delta)
Adds delta to the value currently associated with key, and returns the new value.
|
void |
clear()
Clears all entries from the map.
|
long |
decrementAndGet(K key)
Decrements by one the value currently associated with key, and returns the new value.
|
long |
get(K key)
Returns the value associated with key, or zero if there is no value associated with key.
|
long |
getAndAdd(K key,
long delta)
Adds delta to the value currently associated with key, and returns the old value.
|
long |
getAndDecrement(K key)
Decrements by one the value currently associated with key, and returns the old value.
|
long |
getAndIncrement(K key)
Increments by one the value currently associated with key, and returns the old value.
|
long |
incrementAndGet(K key)
Increments by one the value currently associated with key, and returns the new value.
|
boolean |
isEmpty()
If the map is empty, returns true, otherwise false.
|
default DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
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.
|
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.
|
long |
remove(K key)
Removes and returns the value associated with key.
|
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.
|
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.
|
int |
size()
Returns the number of entries in the map.
|
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
default DistributedPrimitive.Type primitiveType()
DistributedPrimitive
primitiveType
in interface DistributedPrimitive
long incrementAndGet(K key)
key
- key with which the specified value is to be associatedlong decrementAndGet(K key)
key
- key with which the specified value is to be associatedlong getAndIncrement(K key)
key
- key with which the specified value is to be associatedlong getAndDecrement(K key)
key
- key with which the specified value is to be associatedlong addAndGet(K key, long delta)
key
- key with which the specified value is to be associateddelta
- the value to addlong getAndAdd(K key, long delta)
key
- key with which the specified value is to be associateddelta
- the value to addlong get(K key)
key
- key with which the specified value is to be associatedlong put(K key, long newValue)
key
- key with which the specified value is to be associatednewValue
- the value to putlong putIfAbsent(K key, long newValue)
key
- key with which the specified value is to be associatednewValue
- the value to putboolean replace(K key, long expectedOldValue, long newValue)
key
- key with which the specified value is to be associatedexpectedOldValue
- the expected valuenewValue
- the value to replacelong remove(K key)
key
- key with which the specified value is to be associatedboolean remove(K key, long value)
key
- key with which the specified value is to be associatedvalue
- the value to removeint size()
0
valuesboolean isEmpty()
void clear()