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

krathbun pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/3.1 by this push:
     new c40645964e trivial change to how context is closed in Admin.execute
c40645964e is described below

commit c40645964ef1bd02a5ab7ac04dead53d03274658
Author: Kevin Rathbun <kevinrr...@gmail.com>
AuthorDate: Wed Oct 2 12:40:21 2024 -0400

    trivial change to how context is closed in Admin.execute
---
 .../main/java/org/apache/accumulo/server/util/Admin.java  | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java 
b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
index 992470c1fa..f72910687a 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
@@ -424,15 +424,13 @@ public class Admin implements KeywordExecutable {
       return;
     }
 
-    ServerContext context = opts.getServerContext();
+    try (ServerContext context = opts.getServerContext()) {
 
-    AccumuloConfiguration conf = context.getConfiguration();
-    // Login as the server on secure HDFS
-    if (conf.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED)) {
-      SecurityUtil.serverLogin(conf);
-    }
-
-    try {
+      AccumuloConfiguration conf = context.getConfiguration();
+      // Login as the server on secure HDFS
+      if (conf.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED)) {
+        SecurityUtil.serverLogin(conf);
+      }
 
       int rc = 0;
 
@@ -508,7 +506,6 @@ public class Admin implements KeywordExecutable {
       log.error("{}", e.getMessage(), e);
       System.exit(3);
     } finally {
-      context.close();
       SingletonManager.setMode(Mode.CLOSED);
     }
   }

Reply via email to