From b69203f029d55b5d70ad780b9d43862b522bea38 Mon Sep 17 00:00:00 2001 From: Robert LU Date: Mon, 9 Dec 2019 11:47:32 +0800 Subject: [PATCH] Naming the thread of ShellServerImpl (#967) --- .../taobao/arthas/core/shell/impl/ShellServerImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/taobao/arthas/core/shell/impl/ShellServerImpl.java b/core/src/main/java/com/taobao/arthas/core/shell/impl/ShellServerImpl.java index 840cc4ec8..e9730b42f 100644 --- a/core/src/main/java/com/taobao/arthas/core/shell/impl/ShellServerImpl.java +++ b/core/src/main/java/com/taobao/arthas/core/shell/impl/ShellServerImpl.java @@ -31,6 +31,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -148,8 +149,13 @@ public class ShellServerImpl extends ShellServer { public synchronized void setTimer() { if (!closed && reaperInterval > 0) { - scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); - // TODO rename the thread, currently it is `pool-3-thread-1`, which is ambiguous + scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { + @Override + public Thread newThread(Runnable r) { + final Thread t = new Thread(r, "arthas-shell-server"); + return t; + } + }); scheduledExecutorService.scheduleAtFixedRate(new Runnable() { @Override