diff --git pom.xml pom.xml
index 8e791a6..a2a7130 100644
--- pom.xml
+++ pom.xml
@@ -980,7 +980,7 @@
1.1.1
2.1
1.6
- r09
+ 11.0.2
1.5.5
5.5.23
2.1
diff --git src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java
index 1795229..43b1346 100644
--- src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java
+++ src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java
@@ -39,8 +39,9 @@ import org.apache.hadoop.hbase.util.Bytes;
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
@@ -93,18 +94,30 @@ public class SingleSizeCache implements BlockCache, HeapSize {
// 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 = CacheBuilder.newBuilder()
+ .maximumSize(numBlocks - 1)
+ .removalListener(listener)
+ .build()
+ .asMap();
- backingMap = new MapMaker().maximumSize(numBlocks - 1)
- .evictionListener(listener).makeMap();
}