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. UnlikeWeakHashMapthis class does not handle dead keys during common access operations, but expects you to call itsmaintain()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 Constructor Description ManagedConcurrentWeakHashMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<K,V>>entrySet()Vget(Object key)booleanisEmpty()voidmaintain()Method, that has to be invoked periodically to clean dead keys from the map.Vput(K key, V value)VputIfAbsent(K key, V value)Vremove(Object key)booleanremove(Object key, Object value)Vreplace(K key, V value)booleanreplace(K key, V oldValue, V newValue)intsize()Collection<V>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
-
-
-
-
Method Detail
-
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
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>- Overrides:
containsValuein classAbstractMap<K,V>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>- Overrides:
containsKeyin classAbstractMap<K,V>
-
clear
public void clear()
-
putIfAbsent
public V putIfAbsent(K key, V value)
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V>- Specified by:
putIfAbsentin interfaceMap<K,V>
-
values
public Collection<V> values()
-
-