You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2021/11/16 08:05:48 UTC
[phoenix] branch 5.1 updated: PHOENIX-6592 PhoenixStatsCacheLoader uses non-deamon threads
This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.1 by this push:
new ea28f51 PHOENIX-6592 PhoenixStatsCacheLoader uses non-deamon threads
ea28f51 is described below
commit ea28f517158dbb8b0c68ca180579bf543ac82f2f
Author: Istvan Toth <st...@apache.org>
AuthorDate: Mon Nov 15 09:25:17 2021 +0100
PHOENIX-6592 PhoenixStatsCacheLoader uses non-deamon threads
---
.../apache/phoenix/query/PhoenixStatsCacheLoader.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/PhoenixStatsCacheLoader.java b/phoenix-core/src/main/java/org/apache/phoenix/query/PhoenixStatsCacheLoader.java
index b068f31..911d7d1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/PhoenixStatsCacheLoader.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/PhoenixStatsCacheLoader.java
@@ -21,15 +21,18 @@ import org.apache.phoenix.thirdparty.com.google.common.cache.CacheLoader;
import org.apache.phoenix.thirdparty.com.google.common.util.concurrent.Futures;
import org.apache.phoenix.thirdparty.com.google.common.util.concurrent.ListenableFuture;
import org.apache.phoenix.thirdparty.com.google.common.util.concurrent.ListenableFutureTask;
+import org.apache.phoenix.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.hadoop.conf.Configuration;
import org.apache.phoenix.schema.stats.GuidePostsInfo;
import org.apache.phoenix.schema.stats.GuidePostsKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
/**
* {@link CacheLoader} asynchronous implementation for the Phoenix Table Stats cache.
@@ -43,15 +46,20 @@ public class PhoenixStatsCacheLoader extends CacheLoader<GuidePostsKey, GuidePos
public PhoenixStatsCacheLoader(PhoenixStatsLoader statsLoader, Configuration config) {
this.statsLoader = statsLoader;
- if (this.executor == null) {
+ if (executor == null) {
synchronized (PhoenixStatsCacheLoader.class) {
- if (this.executor == null) {
+ if (executor == null) {
// The size of the thread pool used for refreshing cached table stats
final int statsCacheThreadPoolSize = config.getInt(
QueryServices.STATS_CACHE_THREAD_POOL_SIZE,
QueryServicesOptions.DEFAULT_STATS_CACHE_THREAD_POOL_SIZE);
-
- this.executor = Executors.newFixedThreadPool(statsCacheThreadPoolSize);
+ final ThreadFactory threadFactory =
+ new ThreadFactoryBuilder()
+ .setDaemon(true)
+ .setNameFormat("PHOENIX-STATS-CACHE-LOADER-thread-%s")
+ .build();
+ executor =
+ Executors.newFixedThreadPool(statsCacheThreadPoolSize, threadFactory);
}
}
}