Spring scheduler shutdown error

前端 未结 4 1503
青春惊慌失措
青春惊慌失措 2020-12-13 21:22

During development a SPRING based scheduler in a tomcat container, I always get this logoutput at undeploy webapp or shutdown server:

Apr 28, 2010 4:21:33 PM         


        
4条回答
  •  旧时难觅i
    2020-12-13 21:41

    Imho this is an issue of the quartz scheduler. I filed a bug https://jira.terracotta.org/jira/browse/QTZ-192. As a workaround the sleep() solution suggested by Colin Peters works for me. To not trigger the shutdown twice one could also add the sleep to Spring's SchedulerFactoryBean:

    import org.quartz.SchedulerException;
    import org.springframework.scheduling.quartz.SchedulerFactoryBean;
    
    public class SchedulerFactoryBeanWithShutdownDelay extends SchedulerFactoryBean{
    
      @Override
      public void destroy() throws SchedulerException {
        super.destroy();
        // TODO: Ugly workaround for https://jira.terracotta.org/jira/browse/QTZ-192
        try {
          Thread.sleep( 1000 );
        } catch( InterruptedException e ) {
          throw new RuntimeException( e );
        }
      }
    }
    

提交回复
热议问题