K - map key typepublic class DefaultAtomicCounterMap<K> extends Synchronous<AsyncAtomicCounterMap<K>> implements AtomicCounterMap<K>
AtomicCounterMap.DistributedPrimitive.Status, DistributedPrimitive.TypeDEFAULT_OPERATION_TIMEOUT_MILLIS, DEFAULT_OPERTATION_TIMEOUT_MILLIS| Constructor and Description |
|---|
DefaultAtomicCounterMap(AsyncAtomicCounterMap<K> asyncCounterMap,
long operationTimeoutMillis) |
| 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.
|
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.
|
destroy, name, primitiveTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprimitiveTypeaddStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListenerspublic DefaultAtomicCounterMap(AsyncAtomicCounterMap<K> asyncCounterMap, long operationTimeoutMillis)
public long incrementAndGet(K key)
AtomicCounterMapincrementAndGet in interface AtomicCounterMap<K>key - key with which the specified value is to be associatedpublic long decrementAndGet(K key)
AtomicCounterMapdecrementAndGet in interface AtomicCounterMap<K>key - key with which the specified value is to be associatedpublic long getAndIncrement(K key)
AtomicCounterMapgetAndIncrement in interface AtomicCounterMap<K>key - key with which the specified value is to be associatedpublic long getAndDecrement(K key)
AtomicCounterMapgetAndDecrement in interface AtomicCounterMap<K>key - key with which the specified value is to be associatedpublic long addAndGet(K key, long delta)
AtomicCounterMapaddAndGet in interface AtomicCounterMap<K>key - key with which the specified value is to be associateddelta - the value to addpublic long getAndAdd(K key, long delta)
AtomicCounterMapgetAndAdd in interface AtomicCounterMap<K>key - key with which the specified value is to be associateddelta - the value to addpublic long get(K key)
AtomicCounterMapget in interface AtomicCounterMap<K>key - key with which the specified value is to be associatedpublic long put(K key, long newValue)
AtomicCounterMapput in interface AtomicCounterMap<K>key - key with which the specified value is to be associatednewValue - the value to putpublic long putIfAbsent(K key, long newValue)
AtomicCounterMapputIfAbsent in interface AtomicCounterMap<K>key - key with which the specified value is to be associatednewValue - the value to putpublic boolean replace(K key, long expectedOldValue, long newValue)
AtomicCounterMapreplace in interface AtomicCounterMap<K>key - key with which the specified value is to be associatedexpectedOldValue - the expected valuenewValue - the value to replacepublic long remove(K key)
AtomicCounterMapremove in interface AtomicCounterMap<K>key - key with which the specified value is to be associatedpublic boolean remove(K key, long value)
AtomicCounterMapremove in interface AtomicCounterMap<K>key - key with which the specified value is to be associatedvalue - the value to removepublic int size()
AtomicCounterMapsize in interface AtomicCounterMap<K>0 valuespublic boolean isEmpty()
AtomicCounterMapisEmpty in interface AtomicCounterMap<K>public void clear()
AtomicCounterMapclear in interface AtomicCounterMap<K>