ctubbsii commented on code in PR #3361:
URL: https://github.com/apache/accumulo/pull/3361#discussion_r1180475629


##########
server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java:
##########
@@ -45,12 +44,12 @@ public static void main(String[] args) throws Exception {
     try {
       var siteConfig = SiteConfiguration.auto();
       SecurityUtil.serverLogin(siteConfig);
-      var context = new ServerContext(siteConfig);
-      RenameMasterDirInZK.renameMasterDirInZK(context);
-      context.waitForZookeeperAndHdfs();
-      context.getZooReaderWriter().putPersistentData(
-          context.getZooKeeperRoot() + Constants.ZMANAGER_GOAL_STATE, 
args[0].getBytes(UTF_8),
-          NodeExistsPolicy.OVERWRITE);
+      try (var context = new ServerContext(siteConfig)) {

Review Comment:
   Yes, it's safe in this `main` method for `SetGoalState`. We're exiting 
immediately after anyway. The only thing my change did was make sure the 
resource was closed so it shut down any internal thread pools before the 
process exits. This got rid of a warning after removing the other line. I'm not 
sure why my IDE didn't see the warning before, but it didn't. It only noticed 
the unclosed resource after I deleted the other line.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to