Class ConcurrentHashMapWithProducer<K,​V>

  • All Implemented Interfaces:
    java.io.Serializable, java.util.concurrent.ConcurrentMap<K,​V>, java.util.Map<K,​V>

    public class ConcurrentHashMapWithProducer<K,​V>
    extends java.util.concurrent.ConcurrentHashMap<K,​V>
    A concurrent map supporting a value-creating get. There's a small window where the value producing function could be called multiple times on different threads, but the first one will be used and the others thrown away.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMap

        java.util.concurrent.ConcurrentHashMap.KeySetView<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V get​(K key, java.util.concurrent.Callable<V> valueProducer)  
      • Methods inherited from class java.util.concurrent.ConcurrentHashMap

        clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, values
      • Methods inherited from class java.util.AbstractMap

        clone
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ConcurrentHashMapWithProducer

        public ConcurrentHashMapWithProducer()
      • ConcurrentHashMapWithProducer

        public ConcurrentHashMapWithProducer​(int initialCapacity,
                                             float loadFactor,
                                             int concurrencyLevel)
      • ConcurrentHashMapWithProducer

        public ConcurrentHashMapWithProducer​(int initialCapacity,
                                             float loadFactor)
      • ConcurrentHashMapWithProducer

        public ConcurrentHashMapWithProducer​(int initialCapacity)
      • ConcurrentHashMapWithProducer

        public ConcurrentHashMapWithProducer​(java.util.Map<? extends K,​? extends V> m)
    • Method Detail

      • get

        public V get​(K key,
                     java.util.concurrent.Callable<V> valueProducer)
              throws java.lang.Exception
        Throws:
        java.lang.Exception