@@ -136,19 +136,22 @@ private void createCompactionExecutors() {
136136 Preconditions .checkArgument (largeThreads > 0 && smallThreads > 0 );
137137
138138 final String n = Thread .currentThread ().getName ();
139-
140139 StealJobQueue <Runnable > stealJobQueue = new StealJobQueue <Runnable >(COMPARATOR );
141- this .longCompactions = new ThreadPoolExecutor (largeThreads , largeThreads , 60 ,
142- TimeUnit .SECONDS , stealJobQueue ,
143- new ThreadFactoryBuilder ()
144- .setNameFormat (n + "-longCompactions-" + System .currentTimeMillis ())
145- .setDaemon (true ).build ());
140+
141+ AtomicInteger longCompactionThreadCounter = new AtomicInteger (0 );
142+ this .longCompactions =
143+ new ThreadPoolExecutor (largeThreads , largeThreads , 60 , TimeUnit .SECONDS , stealJobQueue ,
144+ new ThreadFactoryBuilder ().setNameFormat (n + "-longCompactions-"
145+ + longCompactionThreadCounter .getAndIncrement () + "-" + System .currentTimeMillis ())
146+ .setDaemon (true ).build ());
146147 this .longCompactions .setRejectedExecutionHandler (new Rejection ());
147148 this .longCompactions .prestartAllCoreThreads ();
148- this .shortCompactions = new ThreadPoolExecutor (smallThreads , smallThreads , 60 ,
149- TimeUnit .SECONDS , stealJobQueue .getStealFromQueue (),
150- new ThreadFactoryBuilder ()
151- .setNameFormat (n + "-shortCompactions-" + System .currentTimeMillis ())
149+
150+ AtomicInteger shortCompactionThreadCounter = new AtomicInteger (0 );
151+ this .shortCompactions = new ThreadPoolExecutor (smallThreads , smallThreads , 60 , TimeUnit .SECONDS ,
152+ stealJobQueue .getStealFromQueue (),
153+ new ThreadFactoryBuilder ().setNameFormat (n + "-shortCompactions-"
154+ + shortCompactionThreadCounter .getAndIncrement () + "-" + System .currentTimeMillis ())
152155 .setDaemon (true ).build ());
153156 this .shortCompactions .setRejectedExecutionHandler (new Rejection ());
154157 }
0 commit comments