/**
  * Close this application context, destroying all beans in its bean factory.
  *
  * <p>Delegates to {@code doClose()} for the actual closing procedure. Also removes a JVM shutdown
  * hook, if registered, as it's not needed anymore.
  *
  * @see #doClose()
  * @see #registerShutdownHook()
  */
 @Override
 public void close() {
   synchronized (this.startupShutdownMonitor) {
     doClose();
     // 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) {
       try {
         Runtime.getRuntime().removeShutdownHook(this.shutdownHook);
       } catch (IllegalStateException ex) {
         // ignore - VM is already shutting down
       }
     }
   }
 }