类 ConcurrentReferenceHashMap<K,​V>

  • 类型参数:
    K - the key type
    V - the value type
    所有已实现的接口:
    ConcurrentMap<K,​V>, Map<K,​V>

    public class ConcurrentReferenceHashMap<K,​V>
    extends AbstractMap<K,​V>
    implements ConcurrentMap<K,​V>
    A ConcurrentHashMap 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 ConcurrentHashMap 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.

    从以下版本开始:
    3.2
    作者:
    Phillip Webb, Juergen Hoeller