dlmarion commented on code in PR #5808:
URL: https://github.com/apache/accumulo/pull/5808#discussion_r2285781471


##########
server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java:
##########
@@ -76,15 +76,7 @@ public static interface ThriftServerSupplier {
   }
 
   public static void startServer(AbstractServer server, Logger LOG) throws 
Exception {
-    try {
-      server.runServer();
-    } catch (Exception e) {
-      System.err
-          .println(server.getClass().getSimpleName() + " died, exception 
thrown from runServer.");
-      e.printStackTrace();
-      LOG.error("{} died, exception thrown from runServer.", 
server.getClass().getSimpleName(), e);
-      throw e;
-    } finally {
+    AutoCloseable ac = () -> {
       try {
         server.close();
       } catch (Exception e) {

Review Comment:
   ```suggestion
         } catch (Throwable e) {
   ```



##########
server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java:
##########
@@ -93,6 +85,16 @@ public static void startServer(AbstractServer server, Logger 
LOG) throws Excepti
         LOG.error("Exception thrown while closing {}", 
server.getClass().getSimpleName(), e);
         throw e;
       }
+    };
+
+    try (var unused = ac) {
+      server.runServer();
+    } catch (Exception e) {

Review Comment:
   ```suggestion
       } catch (Throwable e) {
   ```



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