mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
ignore IllegalStateException when removing shutdown hook (SPR-6793)
This commit is contained in:
+6
-1
@@ -944,7 +944,12 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||
// If we registered a JVM shutdown hook, we don't need it anymore now:
|
||||
// We've already explicitly closed the context.
|
||||
if (this.shutdownHook != null) {
|
||||
Runtime.getRuntime().removeShutdownHook(this.shutdownHook);
|
||||
try {
|
||||
Runtime.getRuntime().removeShutdownHook(this.shutdownHook);
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
// ignore - VM is already shutting down
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user