org.apache.uima.util
Class ConcurrentHashMapWithProducer<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.concurrent.ConcurrentHashMap<K,V>
          extended by org.apache.uima.util.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.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
ConcurrentHashMapWithProducer()
           
ConcurrentHashMapWithProducer(int initialCapacity)
           
ConcurrentHashMapWithProducer(int initialCapacity, float loadFactor)
           
ConcurrentHashMapWithProducer(int initialCapacity, float loadFactor, int concurrencyLevel)
           
ConcurrentHashMapWithProducer(java.util.Map<? extends K,? extends V> m)
           
 
Method Summary
 V get(K key, java.util.concurrent.Callable<V> valueProducer)
           
 
Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, contains, containsKey, containsValue, elements, entrySet, get, isEmpty, keys, keySet, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

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


Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.