spring定时任务线程配备(quartz定时器)

spring定时任务线程配置(quartz定时器)

请注意是quartz定时器,不是timetask定时器!

spring quartz定时器里面有1个选项,表示是否并行 

Java代码   spring定时任务线程配备(quartz定时器)
  1. <property name="concurrent" value="false" />  



如果是false,那么任务之间不能并行。 

意思是: 
1. 如果你是CronTriggerBean,比如每刻钟执行一次——你0分执行第一次,结果20分才执行完,那么它第30分才执行第二次。 

2. 如果你SimpleTriggerBean,比如说每隔15分钟执行一次——你0分执行了第一次,如果20分钟执行完,那么它会立刻执行第二次 

如果是true的话,就反过来。 

 

By default, Quartz Jobs are stateless, resulting in the possibility of jobs interfering with each other. If you specify two triggers for the same JobDetail, it might be possible that before the first job has finished, the second one will start. If JobDetail classes implement the Stateful interface, this won't happen. The second job will not start before the first one has finished. To make jobs resulting from the MethodInvokingJobDetailFactoryBean non-concurrent, set the concurrent flag to false.