This is an automated email from the ASF dual-hosted git repository.

duong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 012a3015bc HDDS-8780. Leak of ManagedChannel in HASecurityUtils (#4850)
012a3015bc is described below

commit 012a3015bc1f1af184c366faa021e66d7cac6b69
Author: Duong Nguyen <[email protected]>
AuthorDate: Wed Jun 7 21:20:56 2023 -0700

    HDDS-8780. Leak of ManagedChannel in HASecurityUtils (#4850)
---
 .../org/apache/hadoop/hdds/scm/ha/HASecurityUtils.java  | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/HASecurityUtils.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/HASecurityUtils.java
index c55478647a..ee25fc50c5 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/HASecurityUtils.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/HASecurityUtils.java
@@ -351,16 +351,11 @@ public final class HASecurityUtils {
         .setRetryPolicy(
             RetryPolicies.retryUpToMaximumCountWithFixedSleep(120,
                 TimeDuration.valueOf(500, TimeUnit.MILLISECONDS)));
-    RaftClient raftClient =  builder.build();
-
-    CompletableFuture<RaftClientReply> future =
-        raftClient.async().send(message);
-
-    RaftClientReply raftClientReply = future.get();
-
-    return SCMRatisResponse.decode(raftClientReply);
-
+    try (RaftClient raftClient = builder.build()) {
+      CompletableFuture<RaftClientReply> future =
+          raftClient.async().send(message);
+      RaftClientReply raftClientReply = future.get();
+      return SCMRatisResponse.decode(raftClientReply);
+    }
   }
-
-
 }


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

Reply via email to