Skip to content

Commit e2967c0

Browse files
committed
HDFS-17766. [ARR] Avoid initializing unused threadPool in RouterAsyncRpcClient.
1 parent 6e43e60 commit e2967c0

File tree

1 file changed

+12
-5
lines changed
  • hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router

1 file changed

+12
-5
lines changed

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,13 @@ public RouterRpcClient(Configuration conf, Router router,
199199
} else {
200200
workQueue = new LinkedBlockingQueue<>();
201201
}
202-
this.executorService = new ThreadPoolExecutor(numThreads, numThreads,
203-
0L, TimeUnit.MILLISECONDS, workQueue, threadFactory);
202+
203+
if (router.getRpcServer().isAsync()) {
204+
this.executorService = null;
205+
} else {
206+
this.executorService = new ThreadPoolExecutor(numThreads, numThreads,
207+
0L, TimeUnit.MILLISECONDS, workQueue, threadFactory);
208+
}
204209

205210
this.rpcMonitor = monitor;
206211

@@ -364,9 +369,11 @@ public String getJSON() {
364369
*/
365370
public String getAsyncCallerPoolJson() {
366371
final Map<String, Integer> info = new LinkedHashMap<>();
367-
info.put("active", executorService.getActiveCount());
368-
info.put("total", executorService.getPoolSize());
369-
info.put("max", executorService.getMaximumPoolSize());
372+
if (executorService != null) {
373+
info.put("active", executorService.getActiveCount());
374+
info.put("total", executorService.getPoolSize());
375+
info.put("max", executorService.getMaximumPoolSize());
376+
}
370377
return JSON.toString(info);
371378
}
372379

0 commit comments

Comments
 (0)