Index: src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java (revision 1355757) +++ src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java (working copy) @@ -38,8 +38,9 @@ import org.apache.hadoop.hbase.util.ClassSize; import org.apache.hadoop.util.StringUtils; -import com.google.common.collect.MapEvictionListener; -import com.google.common.collect.MapMaker; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.RemovalListener; +import com.google.common.cache.RemovalNotification; /** * SingleSizeCache is a slab allocated cache that caches elements up to a single @@ -91,19 +92,31 @@ // This evictionListener is called whenever the cache automatically // evicts // something. - MapEvictionListener listener = new MapEvictionListener() { - @Override - public void onEviction(BlockCacheKey key, CacheablePair value) { - timeSinceLastAccess.set(System.nanoTime() - - value.recentlyAccessed.get()); - stats.evict(); - doEviction(key, value); - } - }; + RemovalListener listener = + new RemovalListener() { + @Override + public void onRemoval( + RemovalNotification notification) { + if (!notification.wasEvicted()) { + // Only process removals by eviction, not by replacement or + // explicit removal + return; + } + CacheablePair value = notification.getValue(); + timeSinceLastAccess.set(System.nanoTime() + - value.recentlyAccessed.get()); + stats.evict(); + doEviction(notification.getKey(), value); + } + }; - backingMap = new MapMaker().maximumSize(numBlocks - 1) - .evictionListener(listener).makeMap(); + backingMap = CacheBuilder.newBuilder() + .maximumSize(numBlocks - 1) + .removalListener(listener) + .build() + .asMap(); + } @Override Index: pom.xml =================================================================== --- pom.xml (revision 1355757) +++ pom.xml (working copy) @@ -977,7 +977,7 @@ 2.1 1.6 2.1.2 - r09 + 11.0.2 1.8.8 5.5.23 2.1