[NO ISSUE][HYR][MISC] Allow a custom logger for thread dump at halt
Ext-ref: MB-67719
Change-Id: I412a13187ed4fcc25fe8283427d92b4a6af8b35d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20123
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Reviewed-by: Hussain Towaileb <hussainht@gmail.com>
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
index 7eb9fd4..11ef619 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
@@ -100,18 +100,18 @@
}
public static void halt(int status) {
- halt(status, Level.FATAL);
+ halt(status, Level.FATAL, LOGGER);
}
- public static synchronized void halt(int status, Level logLevel) {
+ public static synchronized void halt(int status, Level logLevel, Logger threadDumpLogger) {
try {
boolean interrupted = Thread.interrupted();
LOGGER.log(logLevel, "JVM halting with status {} (halting thread {}, interrupted {})", status,
Thread.currentThread(), interrupted);
Future<?> future = haltThreadDumpExecutor.submit(() -> {
- LOGGER.log(logLevel, "Thread dump at halt: {}", ThreadDumpUtil.takeDumpString());
- // try to give time for the log to be emitted...
- LogManager.shutdown();
+ threadDumpLogger.log(logLevel, "Thread dump at halt: {}", ThreadDumpUtil.takeDumpString());
+ // try to give time for the log to be emitted by asking the log manager to shut down...
+ LogManager.shutdown(false, true);
});
future.get(HALT_THREADDUMP_TIMEOUT_SECONDS, TimeUnit.SECONDS);
} catch (Exception e) {