报错信息
WARN org.quartz.impl.jdbcjobstore.JobStoreSupport.findFailedInstances(JobStoreSupport.java:3396) This scheduler instance (XXX) is still active but was recovered by another instance in the cluster. This may cause inconsistent behavior.
产生原因:
quartz使用了集群模式,即有加如下配置
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000
同时使用Quartz时集群下的各机器时间不同步,在相同的数据库(集群)下,存在另外一个相同的应用(可能是测试或其他开发环境)已经在执行该定时任务,Quartz为保证数据一致性,后启动的定时任务不会执行。
解决方案:
方案一:考虑应用是否需要使用集群模式,如果可以不使用集群模式,则把配置的(org.quartz.jobStore.isClustered = true和org.quartz.jobStore.clusterCheckinInterval = 20000)去掉
方案二:如果必须要使用集群模式,则需将集群的各机器时间同步成一样的