code: @Override
    public void initialize(String name, final Scheduler scheduler) throws SchedulerException {
  
      logger.info("Registering Quartz shutdown hook.");
  
      Thread t =
          new Thread("Quartz Shutdown-Hook") {
  
            @Override
            public void run() {
  
              logger.info("Shutting down Quartz...");
              try {
                scheduler.shutdown();
              } catch (SchedulerException e) {
                logger.info("Error shutting down Quartz: " + e.getMessage(), e);
              }
            }
          };
  
      Runtime.getRuntime().addShutdownHook(t);
    }
docs: Called during creation of the <code>Scheduler</code> in order to give the <code>SchedulerPlugin
  </code> a chance to initialize.
  
  @throws SchedulerConfigException if there is an error initializing.