Skip to content

Commit

Permalink
HBASE-22930 Set unique name to longCompactions/shortCompactions threa…
Browse files Browse the repository at this point in the history
…ds (#548)
  • Loading branch information
Pankaj authored and saintstack committed Sep 4, 2019
1 parent 587d744 commit b6d17f6
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,22 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati
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());
this.longCompactions.setRejectedExecutionHandler(new Rejection());
this.longCompactions.prestartAllCoreThreads();
this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads, 60,
TimeUnit.SECONDS, stealJobQueue.getStealFromQueue(),
new ThreadFactoryBuilder()
.setNameFormat(n + "-shortCompactions-" + System.currentTimeMillis())

AtomicInteger shortCompactionThreadCounter = new AtomicInteger(0);
this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads, 60, TimeUnit.SECONDS,
stealJobQueue.getStealFromQueue(),
new ThreadFactoryBuilder().setNameFormat(n + "-shortCompactions-"
+ shortCompactionThreadCounter.getAndIncrement() + "-" + System.currentTimeMillis())
.setDaemon(true).build());
this.shortCompactions.setRejectedExecutionHandler(new Rejection());
this.splits = (ThreadPoolExecutor) Executors.newFixedThreadPool(splitThreads,
Expand Down

0 comments on commit b6d17f6

Please sign in to comment.