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

This commit is contained in:
Pankaj 2019-09-04 21:17:06 +05:30 committed by Michael Stack
parent dfe5280d0c
commit 0f0a3a2273

View File

@ -136,19 +136,22 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati
Preconditions.checkArgument(largeThreads > 0 && smallThreads > 0); Preconditions.checkArgument(largeThreads > 0 && smallThreads > 0);
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,
TimeUnit.SECONDS, stealJobQueue, AtomicInteger longCompactionThreadCounter = new AtomicInteger(0);
new ThreadFactoryBuilder() this.longCompactions =
.setNameFormat(n + "-longCompactions-" + System.currentTimeMillis()) new ThreadPoolExecutor(largeThreads, largeThreads, 60, TimeUnit.SECONDS, stealJobQueue,
.setDaemon(true).build()); new ThreadFactoryBuilder().setNameFormat(n + "-longCompactions-"
+ longCompactionThreadCounter.getAndIncrement() + "-" + System.currentTimeMillis())
.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,
TimeUnit.SECONDS, stealJobQueue.getStealFromQueue(), AtomicInteger shortCompactionThreadCounter = new AtomicInteger(0);
new ThreadFactoryBuilder() this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads, 60, TimeUnit.SECONDS,
.setNameFormat(n + "-shortCompactions-" + System.currentTimeMillis()) stealJobQueue.getStealFromQueue(),
new ThreadFactoryBuilder().setNameFormat(n + "-shortCompactions-"
+ shortCompactionThreadCounter.getAndIncrement() + "-" + System.currentTimeMillis())
.setDaemon(true).build()); .setDaemon(true).build());
this.shortCompactions.setRejectedExecutionHandler(new Rejection()); this.shortCompactions.setRejectedExecutionHandler(new Rejection());
} }