Package org.jivesoftware.smack.util
Class CleaningWeakReferenceMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,WeakReference<V>>
-
- org.jivesoftware.smack.util.CleaningWeakReferenceMap<K,V>
-
- Type Parameters:
K- The key type.V- The value type.
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,WeakReference<V>>
public class CleaningWeakReferenceMap<K,V> extends HashMap<K,WeakReference<V>>
Extends aHashMapwithWeakReferencevalues, so that weak references which have been cleared are periodically removed from the map. The cleaning occurs as part ofput(K, java.lang.ref.WeakReference<V>), after a specific number (cleanInterval) of calls toput(K, java.lang.ref.WeakReference<V>).- See Also:
- Serialized Form
-
-
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 CleaningWeakReferenceMap()Initializes a newCleaningWeakReferenceMapinstance with the default clean interval.CleaningWeakReferenceMap(int cleanInterval)Initializes a newCleaningWeakReferenceMapinstance with a given clean interval.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WeakReference<V>put(K key, WeakReference<V> value)-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Constructor Detail
-
CleaningWeakReferenceMap
public CleaningWeakReferenceMap()
Initializes a newCleaningWeakReferenceMapinstance with the default clean interval.
-
CleaningWeakReferenceMap
public CleaningWeakReferenceMap(int cleanInterval)
Initializes a newCleaningWeakReferenceMapinstance with a given clean interval.- Parameters:
cleanInterval- the number of calls toput(K, java.lang.ref.WeakReference<V>)after which the map will clean itself.
-
-
Method Detail
-
put
public WeakReference<V> put(K key, WeakReference<V> value)
-
-