You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "jinggou (via GitHub)" <gi...@apache.org> on 2023/06/08 04:11:26 UTC

[GitHub] [hbase] jinggou commented on a diff in pull request #5266: HBASE-27902 New async admin api to invoke coproc on multiple servers

jinggou commented on code in PR #5266:
URL: https://github.com/apache/hbase/pull/5266#discussion_r1222428409


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java:
##########
@@ -3505,6 +3506,30 @@ public <S, R> CompletableFuture<R> coprocessorService(Function<RpcChannel, S> st
     return future;
   }
 
+  @Override
+  public <S, R> CompletableFuture<Map<ServerName, Object>> coprocessorService(
+    Function<RpcChannel, S> stubMaker, ServiceCaller<S, R> callable, List<ServerName> serverNames) {
+    CompletableFuture<Map<ServerName, Object>> future = new CompletableFuture<>();
+    Map<ServerName, Object> resultMap = new HashMap<>();
+    for (ServerName rs : serverNames) {
+      FutureUtils.addListener(coprocessorService(stubMaker, callable, rs), (r, e) -> {
+        boolean done;
+        synchronized (resultMap) {
+          if (e != null) {
+            resultMap.put(rs, e);
+          } else {
+            resultMap.put(rs, r);
+          }
+          done = resultMap.size() == serverNames.size();

Review Comment:
   No, we don't have timeout here, but it could be set when client calls this api and gets the result of CompletableFuture.



-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org