Class ManagedConcurrentWeakHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.apache.tomcat.util.collections.ManagedConcurrentWeakHashMap<K,V>
- Type Parameters:
K
- The type of keys used with the Map instanceV
- The type of values used with the Map instance
- All Implemented Interfaces:
ConcurrentMap<K,
,V> Map<K,
V>
public class ManagedConcurrentWeakHashMap<K,V>
extends AbstractMap<K,V>
implements ConcurrentMap<K,V>
Concurrent hash map that holds its keys via weak references. Unlike
WeakHashMap
this class does not handle dead keys during common
access operations, but expects you to call its maintain()
method
periodically. Both keys and values are expected to be not-null
.-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
isEmpty()
void
maintain()
Method, that has to be invoked periodically to clean dead keys from the map.putIfAbsent
(K key, V value) boolean
boolean
int
size()
values()
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, keySet, putAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Constructor Details
-
ManagedConcurrentWeakHashMap
public ManagedConcurrentWeakHashMap()
-
-
Method Details
-
maintain
public void maintain()Method, that has to be invoked periodically to clean dead keys from the map. -
size
-
isEmpty
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V> - Overrides:
containsValue
in classAbstractMap<K,
V>
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
get
-
put
-
remove
-
clear
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
putIfAbsent
in interfaceMap<K,
V>
-
remove
-
replace
-
replace
-
values
-
entrySet
-