Your job class needs to implement StatefulJob
, or alternatively, if you are using Quartz 2.x, be annotated with @DisallowConcurrentExecution
.
This is how concurrent execution can be controlled in Quartz, and in particular MethodInvokingJobDetailFactoryBean
just uses different job classes depending on the value of concurrent
.
quartz job有时我们希望当前的job执行后,再执行下次的job,有两种方法可实现
1、job类实现
StatefulJob接口
2、 在job类前加上@DisallowConcurrentExecution
有时我们不希望程序一次动就执行job等 待下次触发,在quartz.properties中加上:
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true