Quartz Scheduler在关机时内部暂停运行作业?

时间:2015-09-11 18:18:32

标签: java quartz-scheduler

我注意到有时石英调度程序会自动暂停某些作业。这是一个错误还是任何配置问题?

所有预定作业都使用CronTrigger。

我怀疑每当服务器停止时,它可能会自动暂停正在运行的作业?我有以下ServletContextListener代码用于关闭应用程序。

public void shutdownScheduler(Scheduler scheduler) {
    try {
        if (null != scheduler) {
            scheduler.shutdown();
        }
    } catch (Exception e) {
        log.error(e);
    }
}

下面列出了一些石英属性......

org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 20
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
org.quartz.jobStore.misfireThreshold = 60000

1 个答案:

答案 0 :(得分:1)

是的,默认情况下它会进入standBy模式。如果你检查code,你会看到调用shutdown后代码执行的第一件事就是调用{{ 1}}功能。

如果您想避免这种行为,可以选择使用参数调用shutdown:

standby()

将强制shutdown(true) 等待运行作业先完成。 确认是在doc,但遗憾的是不太详细。