HBASE-22930 Set unique name to longCompactions/shortCompactions/split threads (#585)

This commit is contained in:
Pankaj 2019-09-22 15:55:02 +05:30 committed by Peter Somogyi
parent 38c8bd3731
commit 6fe7063ffc
1 changed files with 6 additions and 11 deletions

View File

@ -120,8 +120,7 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati
final String n = Thread.currentThread().getName(); final String n = Thread.currentThread().getName();
int splitThreads = conf.getInt(SPLIT_THREADS, SPLIT_THREADS_DEFAULT); int splitThreads = conf.getInt(SPLIT_THREADS, SPLIT_THREADS_DEFAULT);
this.splits = (ThreadPoolExecutor) Executors.newFixedThreadPool(splitThreads, this.splits = (ThreadPoolExecutor) Executors.newFixedThreadPool(splitThreads,
new ThreadFactoryBuilder().setNameFormat(n + "-splits-" + System.currentTimeMillis()) new ThreadFactoryBuilder().setNameFormat(n + "-splits-%d").setDaemon(true).build());
.setDaemon(true).build());
} }
private void createCompactionExecutors() { private void createCompactionExecutors() {
@ -138,18 +137,14 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati
final String n = Thread.currentThread().getName(); final String n = Thread.currentThread().getName();
StealJobQueue<Runnable> stealJobQueue = new StealJobQueue<Runnable>(COMPARATOR); StealJobQueue<Runnable> stealJobQueue = new StealJobQueue<Runnable>(COMPARATOR);
this.longCompactions = new ThreadPoolExecutor(largeThreads, largeThreads, 60, this.longCompactions = new ThreadPoolExecutor(largeThreads, largeThreads, 60, TimeUnit.SECONDS,
TimeUnit.SECONDS, stealJobQueue, stealJobQueue, new ThreadFactoryBuilder().setNameFormat(n + "-longCompactions-%d")
new ThreadFactoryBuilder()
.setNameFormat(n + "-longCompactions-" + System.currentTimeMillis())
.setDaemon(true).build()); .setDaemon(true).build());
this.longCompactions.setRejectedExecutionHandler(new Rejection()); this.longCompactions.setRejectedExecutionHandler(new Rejection());
this.longCompactions.prestartAllCoreThreads(); this.longCompactions.prestartAllCoreThreads();
this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads, 60, this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads, 60, TimeUnit.SECONDS,
TimeUnit.SECONDS, stealJobQueue.getStealFromQueue(), stealJobQueue.getStealFromQueue(), new ThreadFactoryBuilder()
new ThreadFactoryBuilder() .setNameFormat(n + "-shortCompactions-%d").setDaemon(true).build());
.setNameFormat(n + "-shortCompactions-" + System.currentTimeMillis())
.setDaemon(true).build());
this.shortCompactions.setRejectedExecutionHandler(new Rejection()); this.shortCompactions.setRejectedExecutionHandler(new Rejection());
} }