You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ps...@apache.org on 2019/09/30 08:33:19 UTC
[hbase] branch branch-1.3 updated: HBASE-22930 Set unique name to
longCompactions/shortCompactions threads (#645)
This is an automated email from the ASF dual-hosted git repository.
psomogyi pushed a commit to branch branch-1.3
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1.3 by this push:
new b3e1cf6 HBASE-22930 Set unique name to longCompactions/shortCompactions threads (#645)
b3e1cf6 is described below
commit b3e1cf62800ffbc29a8dce1ac273dbcf844c212b
Author: Pankaj <pa...@huawei.com>
AuthorDate: Mon Sep 30 13:41:21 2019 +0530
HBASE-22930 Set unique name to longCompactions/shortCompactions threads (#645)
Co-authored-by: Peter Somogyi <ps...@apache.org>
---
.../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 e6fe9cd..c35a98d 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);
}
});