saintstack commented on a change in pull request #548: HBASE-22930 Set unique 
name to longCompactions/shortCompactions threads
URL: https://github.com/apache/hbase/pull/548#discussion_r318321645
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java
 ##########
 @@ -136,19 +136,22 @@ private void createCompactionExecutors() {
     Preconditions.checkArgument(largeThreads > 0 && smallThreads > 0);
 
     final String n = Thread.currentThread().getName();
-
     StealJobQueue<Runnable> stealJobQueue = new 
StealJobQueue<Runnable>(COMPARATOR);
-    this.longCompactions = new ThreadPoolExecutor(largeThreads, largeThreads, 
60,
-        TimeUnit.SECONDS, stealJobQueue,
-        new ThreadFactoryBuilder()
-            .setNameFormat(n + "-longCompactions-" + 
System.currentTimeMillis())
-            .setDaemon(true).build());
+
+    AtomicInteger longCompactionThreadCounter = new AtomicInteger(0);
+    this.longCompactions =
+        new ThreadPoolExecutor(largeThreads, largeThreads, 60, 
TimeUnit.SECONDS, stealJobQueue,
+            new ThreadFactoryBuilder().setNameFormat(n + "-longCompactions-"
+                + longCompactionThreadCounter.getAndIncrement() + "-" + 
System.currentTimeMillis())
+                .setDaemon(true).build());
 
 Review comment:
   Does this work @pankaj72981 ?  Each time we create a new thread in 
ThreadPoolExecutor, does the local longCompactionThreadCounter get a 
#getAndIncrement call so each thread gets an id? If so, do we need the 
System.currentTimeMillis thing?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to