[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>
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 abd9fda..f4c4183 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
@@ -103,9 +103,11 @@
 
     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();
             });