HDFS-15373. Fix number of threads in IPCLoggerChannel#createParallelExecutor. Contributed by Ayush Saxena.

This commit is contained in:
Ayush Saxena 2020-05-26 16:26:57 +05:30
parent f43a152b97
commit 6c9f75cf16
1 changed files with 4 additions and 1 deletions

View File

@ -275,12 +275,15 @@ public class IPCLoggerChannel implements AsyncLogger {
int numThreads =
conf.getInt(DFSConfigKeys.DFS_QJOURNAL_PARALLEL_READ_NUM_THREADS_KEY,
DFSConfigKeys.DFS_QJOURNAL_PARALLEL_READ_NUM_THREADS_DEFAULT);
return new ThreadPoolExecutor(1, numThreads, 60L, TimeUnit.SECONDS,
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(numThreads,
numThreads, 60L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(),
new ThreadFactoryBuilder().setDaemon(true)
.setNameFormat("Logger channel (from parallel executor) to " + addr)
.setUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit())
.build());
threadPoolExecutor.allowCoreThreadTimeOut(true);
return threadPoolExecutor;
}
@Override