K
- the key of the mapV
- value of the mappublic class EventListeningConcurrentHashMap<K,V> extends ConcurrentHashMap<K,V>
put(K, V)
and remove(Object)
will trigger events.
The event handler are run in a separate executor service thread(s).ConcurrentHashMap.KeySetView<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
EventListeningConcurrentHashMap(ExecutorService service)
A new instance of
EventListeningConcurrentHashMap . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
V |
put(K key,
V value) |
V |
putIfAbsent(K key,
V value) |
void |
registerEventListener(Runnable runnable,
long minMs)
Register a runnable to be run every time this map is modified.
|
V |
remove(Object key) |
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, putAll, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, values
clone
public EventListeningConcurrentHashMap(ExecutorService service)
EventListeningConcurrentHashMap
.service
- the executor service used to run the event listenerspublic void registerEventListener(Runnable runnable, long minMs)
runnable
- the runnable to runminMs
- the minimum amount of milliseconds that must elapse between executing the
runnable (set to < 0 to capture every single event)public V putIfAbsent(K key, V value)
putIfAbsent
in interface ConcurrentMap<K,V>
putIfAbsent
in interface Map<K,V>
putIfAbsent
in class ConcurrentHashMap<K,V>
public boolean equals(Object o)
Copyright © 2023. All Rights Reserved.