slfan1989 commented on code in PR #4543:
URL: https://github.com/apache/hadoop/pull/4543#discussion_r922600169


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java:
##########
@@ -1366,4 +1386,49 @@ public void shutdown() {
       threadpool.shutdown();
     }
   }
+
+  <R> Map<SubClusterInfo, R> invokeConcurrent(Collection<SubClusterInfo> 
clusterIds,
+       ClientMethod request, Class<R> clazz) throws YarnException, IOException 
{
+    ArrayList<SubClusterInfo> clusterIdList = new ArrayList<>(clusterIds);
+    return invokeConcurrent(clusterIdList, request, clazz);
+  }
+
+  private <R> Map<SubClusterInfo, R> 
invokeConcurrent(ArrayList<SubClusterInfo> subClusterInfo,
+      ClientMethod request, Class<R> clazz) {
+
+    Map<SubClusterInfo, R> results = new HashMap<>();
+
+    // Send the requests in parallel
+    CompletionService<R> compSvc = new 
ExecutorCompletionService<>(this.threadpool);
+
+    for (final SubClusterInfo info : subClusterInfo) {

Review Comment:
   Thanks a lot for the advice, let me learn a lot, the code has been modified.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to