`
jsczxy2
  • 浏览: 1253783 次
  • 性别: Icon_minigender_1
  • 来自: 常州
文章分类
社区版块
存档分类
最新评论

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

阅读更多

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

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

Java代码   收藏代码
  1. <property name="concurrent" value="false" />  



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

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

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

如果是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.

 

PS:新姿势

 <property name="repeatCount" value="0" />  

可以设置除第一次运行之外的运行次数

分享到:
评论
2 楼 jsczxy2 2012-10-17  
shengtu 写道
就反过来是什么意思?

哦 可能我意思不明确 反过来是针对任务是否并行来说的 并不是针对上面2个例子的 也就是说反过来就是直接并行执行
即第15分钟直接执行第二次 不管第一次是否执行完
1 楼 shengtu 2012-10-15  
就反过来是什么意思?

相关推荐

Global site tag (gtag.js) - Google Analytics