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 extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanisEmpty()voidmaintain()Method, that has to be invoked periodically to clean dead keys from the map.putIfAbsent(K key, V value) booleanbooleanintsize()values()Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, keySet, putAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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
public int size() -
isEmpty
public boolean isEmpty() -
containsValue
- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classAbstractMap<K,V>
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
get
-
put
-
remove
-
clear
public void clear() -
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
remove
-
replace
-
replace
-
values
-
entrySet
-