Skip to content
Permalink
Browse files
[NO ISSUE][HYR][MISC] Clear interrupted state on halt
Clear the calling thread's interrupted state on halt, to enable collection of
thread dump at exit. Should the thread be interrupted again before the thread
dump has completed, the collection will be aborted and the halt will proceed.

Change-Id: I29584c059bdae32baff67ba6f6d435cc8458b107
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/11083
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Michael Blow <mblow@apache.org>
  • Loading branch information
mblow committed Apr 15, 2021
1 parent 94b1306 commit 33647b6519671b5074c158f822193ce2db41b7a0
Showing 1 changed file with 4 additions and 2 deletions.
@@ -103,9 +103,11 @@ public static void halt(int status) {

public static synchronized void halt(int status, Level logLevel) {
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, "JVM halting with status {}; thread dump at halt: {}", status,
ThreadDumpUtil.takeDumpString());
LOGGER.log(logLevel, "Thread dump at halt: {}", ThreadDumpUtil.takeDumpString());
// try to give time for the log to be emitted...
LogManager.shutdown();
});

0 comments on commit 33647b6

Please sign in to comment.