gpt4 book ai didi

java - Quartz Scheduler 在关闭时在内部暂停正在运行的作业?

转载 作者:行者123 更新时间:2023-11-30 07:57:01 27 4
gpt4 key购买 nike

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

所有计划作业都使用 CronTrigger。

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

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

下面列出了一些 quartz 特性...

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

最佳答案

是的,默认情况下它会进入待机模式。如果您选中 code您将看到代码在调用 shutdown 后所做的第一件事就是调用 standby() 函数。

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

shutdown(true)

这将强制Scheduler首先等待正在运行的作业完成。确认信息在 doc ,但遗憾的是没有太多细节。

关于java - Quartz Scheduler 在关闭时在内部暂停正在运行的作业?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32529787/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com