prevent unnecessary exception (#4905)

This commit is contained in:
Parag Jain 2017-10-06 13:35:45 -05:00 committed by Himanshu
parent 35944d24ae
commit ef67915d9c
1 changed files with 6 additions and 1 deletions

View File

@ -305,7 +305,12 @@ public class CliPeon extends GuiceRunnable
// Explicitly call lifecycle stop, dont rely on shutdown hook.
lifecycle.stop();
Runtime.getRuntime().removeShutdownHook(hook);
try {
Runtime.getRuntime().removeShutdownHook(hook);
}
catch (IllegalStateException e) {
log.warn("Cannot remove shutdown hook, already shutting down");
}
}
catch (Throwable t) {
log.error(t, "Error when starting up. Failing.");