Index: src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (revision 1224680) +++ src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (working copy) @@ -29,12 +29,16 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import java.util.NavigableMap; import java.util.NoSuchElementException; -import java.util.Map.Entry; import java.util.Set; +import java.util.SortedMap; import java.util.TreeSet; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentNavigableMap; +import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -65,7 +69,6 @@ import org.apache.hadoop.hbase.ipc.HRegionInterface; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; -import org.apache.hadoop.hbase.util.SoftValueSortedMap; import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.hbase.zookeeper.RootRegionTracker; import org.apache.hadoop.hbase.zookeeper.ZKTable; @@ -464,9 +467,8 @@ * Map of table to table {@link HRegionLocation}s. The table key is made * by doing a {@link Bytes#mapKey(byte[])} of the table's name. */ - private final Map> - cachedRegionLocations = - new HashMap>(); + private final Map> cachedRegionLocations = + new HashMap>(); // region cache prefetch is enabled by default. this set contains all // tables whose region cache prefetch are disabled. @@ -1036,7 +1038,7 @@ */ HRegionLocation getCachedLocation(final byte [] tableName, final byte [] row) { - SoftValueSortedMap tableLocations = + NavigableMap tableLocations = getTableLocations(tableName); // start to examine the cache. we can only do cache actions @@ -1052,7 +1054,7 @@ // Cut the cache so that we only get the part that could contain // regions that match our key - SoftValueSortedMap matchingRegions = + SortedMap matchingRegions = tableLocations.headMap(row); // if that portion of the map is empty, then we're done. otherwise, @@ -1095,7 +1097,7 @@ */ void deleteCachedLocation(final byte [] tableName, final byte [] row) { synchronized (this.cachedRegionLocations) { - SoftValueSortedMap tableLocations = + Map tableLocations = getTableLocations(tableName); // start to examine the cache. we can only do cache actions // if there's something in the cache for this table. @@ -1118,16 +1120,16 @@ * @param tableName * @return Map of cached locations for passed tableName */ - private SoftValueSortedMap getTableLocations( + private NavigableMap getTableLocations( final byte [] tableName) { // find the map of cached locations for this table Integer key = Bytes.mapKey(tableName); - SoftValueSortedMap result; + ConcurrentNavigableMap result; synchronized (this.cachedRegionLocations) { result = this.cachedRegionLocations.get(key); // if tableLocations for this table isn't built yet, make one if (result == null) { - result = new SoftValueSortedMap( + result = new ConcurrentSkipListMap( Bytes.BYTES_COMPARATOR); this.cachedRegionLocations.put(key, result); } @@ -1155,7 +1157,7 @@ private void cacheLocation(final byte [] tableName, final HRegionLocation location) { byte [] startKey = location.getRegionInfo().getStartKey(); - SoftValueSortedMap tableLocations = + Map tableLocations = getTableLocations(tableName); if (tableLocations.put(startKey, location) == null) { LOG.debug("Cached location for " + @@ -1483,7 +1485,7 @@ int getNumberOfCachedRegionLocations(final byte[] tableName) { Integer key = Bytes.mapKey(tableName); synchronized (this.cachedRegionLocations) { - SoftValueSortedMap tableLocs = + Map tableLocs = this.cachedRegionLocations.get(key); if (tableLocs == null) {