THRIFT-5433: Add Counter To Thread Name of TThreadPoolServer

Client: Java
Patch: David Mollitor
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.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 @@
   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;
           }
         });