You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "pankaj72981 (via GitHub)" <gi...@apache.org> on 2024/07/16 19:34:26 UTC

Re: [PR] HBASE-28428 : Zookeeper ConnectionRegistry APIs should have timeout [hbase]

pankaj72981 commented on code in PR #5837:
URL: https://github.com/apache/hbase/pull/5837#discussion_r1679968276


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ReadOnlyZKClient.java:
##########
@@ -258,6 +264,23 @@ public void closed(IOException e) {
     }
   }
 
+  private static TimerTask getTimerTask(final long timeoutMs, final CompletableFuture<?> future,
+    final String api) {
+    return timeout -> {
+      if (!future.isDone()) {
+        future.completeExceptionally(new DoNotRetryIOException(
+          "Zookeeper " + api + " could not be completed in " + timeoutMs + " ms"));
+      }
+    };
+  }
+
+  public CompletableFuture<byte[]> getWithTimeout(final String path, final long timeoutMs) {

Review Comment:
   nit: Can we overload the existing methods instead of creating new methods with Timeout suffix?
   eg.
   ` public CompletableFuture<byte[]> get(final String path, final long timeoutMs) `



-- 
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