HDFS-11900. Hedged reads thread pool creation not synchronized. Contributed by John Zhuge.

This commit is contained in:
Wei-Chiu Chuang 2018-03-22 11:29:31 -07:00
parent 268c29a5f5
commit f738d75a86

View File

@ -2910,7 +2910,7 @@ void updateFileSystemReadStats(int distance, int nRead) {
* @param num Number of threads for hedged reads thread pool. * @param num Number of threads for hedged reads thread pool.
* If zero, skip hedged reads thread pool creation. * If zero, skip hedged reads thread pool creation.
*/ */
private synchronized void initThreadsNumForHedgedReads(int num) { private static synchronized void initThreadsNumForHedgedReads(int num) {
if (num <= 0 || HEDGED_READ_THREAD_POOL != null) return; if (num <= 0 || HEDGED_READ_THREAD_POOL != null) return;
HEDGED_READ_THREAD_POOL = new ThreadPoolExecutor(1, num, 60, HEDGED_READ_THREAD_POOL = new ThreadPoolExecutor(1, num, 60,
TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),