Package org.intermine.util
Class SoftReferenceMap<K,V>
- java.lang.Object
-
- org.intermine.util.ReferenceMap<K,V>
-
- org.intermine.util.SoftReferenceMap<K,V>
-
- Type Parameters:
K
- the type of keys maintained by this mapV
- the type of mapped values
- All Implemented Interfaces:
java.util.Map<K,V>
- Direct Known Subclasses:
CacheMap
public abstract class SoftReferenceMap<K,V> extends ReferenceMap<K,V>
This is a Map implementation designed specifically for people intending to create a cache. The keys are held strongly, but the values are held softly, so the values can be garbage-collected. When an entry is garbage-collected, its key is removed from the Map on the next Map activity. Subclasses of this map are required to provide the actual Map functionality.The entrySet() and values() methods of this class do not work.
- Author:
- Matthew Wakeling
- See Also:
SoftReference
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.intermine.util.ReferenceMap
ReferenceMap.ReferenceWithKey<K>
-
-
Field Summary
-
Fields inherited from class org.intermine.util.ReferenceMap
name, NULL_VALUE, queue, subMap
-
-
Constructor Summary
Constructors Constructor Description SoftReferenceMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.intermine.util.SoftReferenceMap.SoftReferenceWithKey<K>
newRef(java.lang.Object value, java.lang.ref.ReferenceQueue<java.lang.Object> queue, K key)
Returns a new SoftReferenceWithKey object for the given objects.-
Methods inherited from class org.intermine.util.ReferenceMap
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
-
-
-
-
Method Detail
-
newRef
protected org.intermine.util.SoftReferenceMap.SoftReferenceWithKey<K> newRef(java.lang.Object value, java.lang.ref.ReferenceQueue<java.lang.Object> queue, K key)
Returns a new SoftReferenceWithKey object for the given objects.- Specified by:
newRef
in classReferenceMap<K,V>
- Parameters:
value
- an Objectqueue
- a ReferenceQueuekey
- an Object- Returns:
- a SoftReferenceWithKey object
-
-