Index: hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java (revision 1470122) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java (working copy) @@ -59,7 +59,7 @@ private int poolMaxSize; - private Map> pools = new ConcurrentHashMap>(); + private ConcurrentHashMap> pools = new ConcurrentHashMap>(); public PoolMap(PoolType poolType) { this.poolType = poolType; @@ -78,11 +78,13 @@ @Override public V put(K key, V value) { - Pool pool = pools.get(key); + Pool emptyPool = createPool(); + Pool pool = pools.putIfAbsent(key, emptyPool); if (pool == null) { - pools.put(key, pool = createPool()); + return emptyPool.put(value); + } else { + return pool.put(value); } - return pool != null ? pool.put(value) : null; } @SuppressWarnings("unchecked")