You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/06/03 06:48:49 UTC

[GitHub] [hbase] Apache9 commented on a change in pull request #1839: HBASE-24497: Close one off connections in RawSyncHBaseAdmin.

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:
users@infra.apache.org