peterxcli commented on code in PR #8058: URL: https://github.com/apache/ozone/pull/8058#discussion_r1991300952
########## hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java: ########## @@ -531,16 +511,18 @@ private static void stopRecon(ReconServer reconServer) { } } - private static void stopS3G(Gateway s3g) { - try { - if (s3g != null) { - LOG.info("Stopping S3G"); - // TODO (HDDS-11539): Remove this workaround once the @PreDestroy issue is fixed - OzoneClientCache.closeClient(); - s3g.stop(); + private static void stopServices(List<Service> services) { + // stop in reverse order + List<Service> reverse = new ArrayList<>(services); + Collections.reverse(reverse); + + for (Service service : reverse) { + try { + service.stop(); + LOG.info("Stopped {}", service); + } catch (Exception e) { + LOG.error("Error stopping {}", service, e); Review Comment: nit: ```suggestion ListIterator<Service> iterator = services.listIterator(services.size()); while (iterator.hasPrevious()) { Service service = iterator.previous(); try { service.stop(); LOG.info("Stopped {}", service); } catch (Exception e) { LOG.error("Error stopping {}", service, e); ``` However, this has worse readability, so please take it with a grain of salt. -- 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: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org