Skip to content

Commit

Permalink
fix(trace):ignore IllegalStateException when remove shutdown hook
Browse files Browse the repository at this point in the history
If shutdown of the JVM in progress already, we don't need to remove the hook, it will be removed by the JVM.

Close alibaba#1491
  • Loading branch information
RongtongJin committed Sep 27, 2019
1 parent 203272c commit 9d18256
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ public void run() {

public void removeShutdownHook() {
if (shutDownHook != null) {
Runtime.getRuntime().removeShutdownHook(shutDownHook);
try {
Runtime.getRuntime().removeShutdownHook(shutDownHook);
} catch (IllegalStateException e) {
// ignore - VM is already shutting down
}
}
}

Expand Down

0 comments on commit 9d18256

Please sign in to comment.