This is an automated email from the ASF dual-hosted git repository.
psomogyi pushed a commit to branch branch-1.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1.4 by this push:
new 97a7578 HBASE-22930 Set unique name to
longCompactions/shortCompactions threads (#645)
97a7578 is described below
commit 97a7578c41e372fec00e69238da93faa104f2cb9
Author: Pankaj <[email protected]>
AuthorDate: Mon Sep 30 13:41:21 2019 +0530
HBASE-22930 Set unique name to longCompactions/shortCompactions threads
(#645)
Co-authored-by: Peter Somogyi <[email protected]>
---
.../hbase/regionserver/CompactSplitThread.java | 28 ++++++++++++----------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
index d35d620..09a3d06 100644
---
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
+++
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
@@ -31,6 +31,7 @@ import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -118,35 +119,38 @@ public class CompactSplitThread implements
CompactionRequestor, PropagatingConfi
final String n = Thread.currentThread().getName();
- StealJobQueue<Runnable> stealJobQueue = new StealJobQueue<>();
- this.longCompactions = new ThreadPoolExecutor(largeThreads, largeThreads,
- 60, TimeUnit.SECONDS, stealJobQueue,
- new ThreadFactory() {
+ StealJobQueue<Runnable> stealJobQueue = new StealJobQueue<Runnable>();
+ this.longCompactions = new ThreadPoolExecutor(largeThreads, largeThreads,
60, TimeUnit.SECONDS,
+ stealJobQueue, new ThreadFactory() {
+ AtomicInteger longCompactionThreadCounter = new AtomicInteger(0);
+
@Override
public Thread newThread(Runnable r) {
- String name = n + "-longCompactions-" + System.currentTimeMillis();
+ String name = n + "-longCompactions-" +
longCompactionThreadCounter.getAndIncrement();
return new Thread(r, name);
}
});
this.longCompactions.setRejectedExecutionHandler(new Rejection());
this.longCompactions.prestartAllCoreThreads();
- this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads,
- 60, TimeUnit.SECONDS, stealJobQueue.getStealFromQueue(),
- new ThreadFactory() {
+ this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads,
60, TimeUnit.SECONDS,
+ stealJobQueue.getStealFromQueue(), new ThreadFactory() {
+ AtomicInteger shortCompactionThreadCounter = new AtomicInteger(0);
+
@Override
public Thread newThread(Runnable r) {
- String name = n + "-shortCompactions-" +
System.currentTimeMillis();
+ String name = n + "-shortCompactions-" +
shortCompactionThreadCounter.getAndIncrement();
return new Thread(r, name);
}
});
this.shortCompactions
.setRejectedExecutionHandler(new Rejection());
this.splits = (ThreadPoolExecutor)
- Executors.newFixedThreadPool(splitThreads,
- new ThreadFactory() {
+ Executors.newFixedThreadPool(splitThreads, new ThreadFactory() {
+ AtomicInteger splitThreadCounter = new AtomicInteger(0);
+
@Override
public Thread newThread(Runnable r) {
- String name = n + "-splits-" + System.currentTimeMillis();
+ String name = n + "-splits-" +
splitThreadCounter.getAndIncrement();
return new Thread(r, name);
}
});