From 3426777140d6dfd7bda13c23eb030fea75201307 Mon Sep 17 00:00:00 2001 From: Bharat Viswanadham Date: Thu, 25 Jul 2019 22:30:06 -0700 Subject: [PATCH] HDDS-1861. Fix TableCacheImpl cleanup logic. (#1165) --- .../org/apache/hadoop/utils/db/cache/TableCacheImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/cache/TableCacheImpl.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/cache/TableCacheImpl.java index 7a9d55b18a..e6dabf13b5 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/cache/TableCacheImpl.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/cache/TableCacheImpl.java @@ -21,8 +21,9 @@ import java.util.Iterator; import java.util.Map; -import java.util.TreeSet; +import java.util.NavigableSet; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; @@ -47,7 +48,7 @@ public class TableCacheImpl implements TableCache { private final ConcurrentHashMap cache; - private final TreeSet> epochEntries; + private final NavigableSet> epochEntries; private ExecutorService executorService; private CacheCleanupPolicy cleanupPolicy; @@ -55,7 +56,7 @@ public class TableCacheImpl(); - epochEntries = new TreeSet<>(); + epochEntries = new ConcurrentSkipListSet<>(); // Created a singleThreadExecutor, so one cleanup will be running at a // time. ThreadFactory build = new ThreadFactoryBuilder().setDaemon(true)