This is an automated email from the ASF dual-hosted git repository.

dmollitor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 5cada6a  THRIFT-5433: Add Counter To Thread Name of TThreadPoolServer
5cada6a is described below

commit 5cada6a3202a0e5e11ff36dfbb925f0e037bf856
Author: belugabehr <[email protected]>
AuthorDate: Wed Jun 30 09:08:34 2021 -0400

    THRIFT-5433: Add Counter To Thread Name of TThreadPoolServer
    
    Client: Java
    Patch: David Mollitor
---
 lib/java/src/org/apache/thrift/server/TThreadPoolServer.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java 
b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
index 01749b9..e190415 100644
--- a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
+++ b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
@@ -26,6 +26,7 @@ import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.thrift.TException;
 import org.apache.thrift.TProcessor;
@@ -100,11 +101,12 @@ public class TThreadPoolServer extends TServer {
   private static ExecutorService createDefaultExecutorService(Args args) {
     return new ThreadPoolExecutor(args.minWorkerThreads, 
args.maxWorkerThreads, 60L, TimeUnit.SECONDS,
         new SynchronousQueue<>(), new ThreadFactory() {
+          final AtomicLong count = new AtomicLong();
           @Override
           public Thread newThread(Runnable r) {
             Thread thread = new Thread(r);
             thread.setDaemon(true);
-            thread.setName("TThreadPoolServer WorkerProcess-%d");
+            thread.setName(String.format("TThreadPoolServer WorkerProcess-%d", 
count.getAndIncrement()));
             return thread;
           }
         });

Reply via email to