Browse Source

ignore IllegalStateException when removing shutdown hook (SPR-6793)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2919 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
488060fbd1
  1. 7
      org.springframework.context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

7
org.springframework.context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

@ -944,7 +944,12 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader @@ -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
}
}
}
}

Loading…
Cancel
Save