Skip to content

Commit

Permalink
[fix][cli] Fix logging noise while admin tool exit (apache#19884)
Browse files Browse the repository at this point in the history
Co-authored-by: tison <wander4096@gmail.com>
  • Loading branch information
rdhabalia and tisonkun authored Jun 6, 2023
1 parent fff5e39 commit ad352a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private static void exit(int code) {
if (allowSystemExit) {
// we are using halt and not System.exit, we do not mind about shutdown hooks
// they are only slowing down the tool
ShutdownUtil.triggerImmediateForcefulShutdown(code);
ShutdownUtil.triggerImmediateForcefulShutdown(code, false);
} else {
System.out.println("Exit code is " + code + " (System.exit not called, as we are in test mode)");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ public class ShutdownUtil {
* @see Runtime#halt(int)
*/
public static void triggerImmediateForcefulShutdown(int status) {
triggerImmediateForcefulShutdown(status, true);
}
public static void triggerImmediateForcefulShutdown(int status, boolean logging) {
try {
if (status != 0) {
if (status != 0 && logging) {
log.warn("Triggering immediate shutdown of current process with status {}", status,
new Exception("Stacktrace for immediate shutdown"));
}
Expand Down

0 comments on commit ad352a9

Please sign in to comment.