Class CmsNullIgnoringConcurrentMap<K,V>

java.lang.Object
org.opencms.util.CmsNullIgnoringConcurrentMap<K,V>
Type Parameters:
K - the key type
V - the value type
All Implemented Interfaces:
Map<K,V>

public class CmsNullIgnoringConcurrentMap<K,V> extends Object implements Map<K,V>
Wrapper around ConcurrentHashMap which allows null values.

The point of this is the following: Often, HashMaps in older code are accessed concurrently by multiple threads. When these threads modify the map concurrently, an infinite loop may occur due to the standard HashMap implementation. But sometimes we can't just replace the HashMap with a ConcurrentHashMap because that class doesn't allow null values and we don't always know for certain whether null values are used or not. But if we don't care about the distinction about null values and entries not being present, we can use this map class which will just log an error and remove the entry when trying to set a null value. NOTE: Currently this wrapper does *not* check value modifications made to entries returned by entrySet!