Skip to content

Commit

Permalink
Ignore exceptions from removing shutdown hooks during shutdown.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 413385002
  • Loading branch information
larsrc-google authored and copybara-github committed Dec 1, 2021
1 parent aa52f2d commit 9ee1362
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ void destroy() {
workerProtocol = null;
}
if (shutdownHook != null) {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
try {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
} catch (IllegalStateException e) {
// Can only happen if we're already in shutdown, in which case we don't care.
}
}
if (process != null) {
wasDestroyed = true;
Expand Down

0 comments on commit 9ee1362

Please sign in to comment.