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>

public class ConcurrentSoftHashMap<K,V> extends AbstractMap<K,V> implements ConcurrentMap<K,V>
A memory-sensitive ConcurrentMap which stores the values in SoftReferences. 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