Class ConcurrentSoftHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
VASSAL.tools.concurrent.ConcurrentSoftHashMap<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,
,V> Map<K,
V>
A memory-sensitive
ConcurrentMap
which stores the values
in SoftReference
s. This ConcurrentMap
grows
without bound, but when the JVM is under memory pressure, values
held by it may be garbage collected.
All methods except get(java.lang.Object)
cause the Map
to
be cleared of key-value pairs for which the value has been garbage
collected. Processing key-value pairs with dead values is not
an atomic operation. Thus, it is possible, though unlikely, that more
values will be garbage collected between the removal of dead key-value
pairs and the return of the method in which this takes place.
This implementation does not permit null
keys or
values.
- Since:
- 3.1.0
- Author:
- Joel Uckelman
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleImmutableEntry<K,
V> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) entrySet()
putIfAbsent
(K key, V value) boolean
boolean
int
size()
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values
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
-
Constructor Details
-
ConcurrentSoftHashMap
public ConcurrentSoftHashMap()
-
-
Method Details
-
size
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
get
-
put
-
remove
-
clear
-
entrySet
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
putIfAbsent
in interfaceMap<K,
V>
-
remove
-
replace
-
replace
-