Apache9 commented on a change in pull request #1839:
URL: https://github.com/apache/hbase/pull/1839#discussion_r434343419



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
##########
@@ -3521,20 +3522,33 @@ private void getProcedureResult(long procId, 
CompletableFuture<Void> future, int
       return failedFuture(e);
     }
     CompletableFuture<Void> future = new CompletableFuture<>();
-    addListener(ConnectionFactory.createAsyncConnection(peerConf), (conn, err) 
-> {
+    CompletableFuture<AsyncConnection> cf = 
ConnectionFactory.createAsyncConnection(peerConf);
+    addListener(cf, (conn, err) -> {
       if (err != null) {
-        future.completeExceptionally(err);
+        try {
+          future.completeExceptionally(err);
+        } finally {
+          IOUtils.closeQuietly(conn);

Review comment:
       This method has been deprecated IIRC? Can use Closeables.close instead.
   
   And maybe we could just call addListener on the above 'future', to close the 
AsyncConnection? Then we do not need to add close code everwhere.




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

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


Reply via email to