Class SoftValueMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.apache.cayenne.util.SoftValueMap<K,V>
- All Implemented Interfaces:
Serializable, Map<K,V>
Map that stores values wrapped into
SoftReference- Since:
- 4.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionThis is a lazily created set of entries that is essentially a view to actual dataprotected HashMap<K, SoftReference<V>> This is a main data storage used for most operationsprotected ReferenceQueue<V> -
Constructor Summary
ConstructorsConstructorDescriptionSoftValueMap(int initialCapacity) SoftValueMap(Map<? extends K, ? extends V> m) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCleanup all references collected by GC so farvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanisEmpty()keySet()voidvoidsetKeyCleanupCallback(Consumer<K> keyCleanupCallback) Set callback that will be notified with a key on each value removal due to the corresponding value reference cleaned up by the GC.intsize()values()Methods inherited from class AbstractMap
clone, equals, hashCode, toStringMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
map
This is a main data storage used for most operations -
referenceQueue
-
entrySet
-
keyCleanupCallback
-
-
Constructor Details
-
SoftValueMap
public SoftValueMap() -
SoftValueMap
public SoftValueMap(int initialCapacity) -
SoftValueMap
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceMap<K,V> - Overrides:
sizein classAbstractMap<K,V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMap<K,V> - Overrides:
isEmptyin classAbstractMap<K,V>
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classAbstractMap<K,V>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear()- Specified by:
clearin interfaceMap<K,V> - Overrides:
clearin classAbstractMap<K,V>
-
keySet
-
values
- Specified by:
valuesin interfaceMap<K,V> - Overrides:
valuesin classAbstractMap<K,V>
-
entrySet
-
setKeyCleanupCallback
-
checkReferenceQueue
protected void checkReferenceQueue()Cleanup all references collected by GC so far
-