diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java index bf5807367c76..bdb90be80f54 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java @@ -136,19 +136,22 @@ private void createCompactionExecutors() { Preconditions.checkArgument(largeThreads > 0 && smallThreads > 0); final String n = Thread.currentThread().getName(); - StealJobQueue stealJobQueue = new StealJobQueue(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()); }