[ 
https://issues.apache.org/jira/browse/HDFS-17766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17939874#comment-17939874
 ] 

ASF GitHub Bot commented on HDFS-17766:
---------------------------------------

KeeProMise commented on code in PR #7561:
URL: https://github.com/apache/hadoop/pull/7561#discussion_r2022091941


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java:
##########
@@ -199,8 +199,13 @@ public RouterRpcClient(Configuration conf, Router router,
     } else {
       workQueue = new LinkedBlockingQueue<>();
     }
-    this.executorService = new ThreadPoolExecutor(numThreads, numThreads,
-        0L, TimeUnit.MILLISECONDS, workQueue, threadFactory);
+    
+    if (router.isAsync()) {
+      this.executorService = null;
+    } else {
+      this.executorService = new ThreadPoolExecutor(numThreads, numThreads,
+          0L, TimeUnit.MILLISECONDS, workQueue, threadFactory);
+    }

Review Comment:
   From my perspective, I think we can add an initExecutorService() method in 
RouterRpcClient, and then have RouterAsyncRpcClient inherit this method. In 
RouterRpcClient, we can initialize the executorService normally, but in 
RouterAsyncRpcClient, this method can be left as an empty implementation.





> [ARR] Avoid initializing unused threadPool in RouterAsyncRpcClient
> ------------------------------------------------------------------
>
>                 Key: HDFS-17766
>                 URL: https://issues.apache.org/jira/browse/HDFS-17766
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: rbf
>            Reporter: farmmamba
>            Assignee: farmmamba
>            Priority: Major
>              Labels: pull-request-available
>
> Avoid initializing unused threadPool in RouterAsyncRpcClient.
> This can save thread resources.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to