ConcurrentReferenceHashMap
A ConcurrentHashMap variant that uses soft or weak references for both keys and values.
This class can be used as an alternative to Collections.synchronizedMap(new
WeakHashMap<K, Reference<V>>()) in order to support better performance when accessed concurrently. This implementation follows the same design constraints as with the exception that null values and null keys are supported.
NOTE: The use of references means that there is no guarantee that items placed into the map will be subsequently available. The garbage collector may discard references at any time, so it may appear that an unknown thread is silently removing entries.
If not explicitly specified, this implementation will use soft entry references.
Author
Phillip Webb
Juergen Hoeller
Brian Clozel
Since
3.2
Parameters
the key type
the value type
Constructors
ConcurrentReferenceHashMap instance.ConcurrentReferenceHashMap instance.ConcurrentReferenceHashMap instance.ConcurrentReferenceHashMap instance.ConcurrentReferenceHashMap instance.ConcurrentReferenceHashMap instance.ConcurrentReferenceHashMap instance.