diff --git a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HiveClientCache.java b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HiveClientCache.java index 730b6ef..ffa648d 100644 --- a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HiveClientCache.java +++ b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HiveClientCache.java @@ -24,6 +24,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -44,6 +45,7 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.RemovalListener; import com.google.common.cache.RemovalNotification; +import com.google.common.util.concurrent.ThreadFactoryBuilder; /** * A thread safe time expired cache for HiveMetaStoreClient @@ -59,7 +61,7 @@ private static final AtomicInteger nextId = new AtomicInteger(0); - private ScheduledFuture cleanupHandle; // used to cleanup cache + private final ScheduledFuture cleanupHandle; // used to cleanup cache // Since HiveMetaStoreClient is not threadsafe, hive clients are not shared across threads. // Thread local variable containing each thread's unique ID, is used as one of the keys for the cache @@ -91,6 +93,7 @@ public HiveClientCache(final int timeout) { this.timeout = timeout; RemovalListener removalListener = new RemovalListener() { + @Override public void onRemoval(RemovalNotification notification) { CacheableHiveMetaStoreClient hiveMetaStoreClient = notification.getValue(); if (hiveMetaStoreClient != null) { @@ -108,6 +111,7 @@ public void onRemoval(RemovalNotification