spring+quartz定时器配置

zh320123 2012-11-09 01:23:17
遇到个问题,我配置的定时器是半个小时运行一次,

当当前这个定时任务在运行,半小时到后,又要启动该定时任务,可是上次还没有运行完,如何控制当前任务在上次任务还没有运行完,而不允许允许的
...全文
176 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
枫桥 2012-11-12
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean id="triggerUtil" class="cn.itcast.utils.timer.Triger"/> <bean id="triggerUtil2" class="cn.itcast.utils.timer.Trigers"/> <!-- 指定任务(方法) --> <bean id="expDataBaseJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <!-- 调用的任务类 --> <property name="targetObject"> <ref local="triggerUtil" /> </property> <!-- 调用的方法 --> <property name="targetMethod"> <value>test</value> </property> </bean> <bean id="expDataBaseJob2" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <!-- 调用的任务类 --> <property name="targetObject"> <ref local="triggerUtil2" /> </property> <!-- 调用的方法 --> <property name="targetMethod"> <value>test2</value> </property> </bean> <!-- 设定计划执行时间 --> <bean id="expDataBaseTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref local="expDataBaseJob" /> </property> <property name="cronExpression"> <value>0 * 16 * * ?</value> </property> </bean> <!-- 设定计划执行时间 --> <bean id="expDataBaseTrigger2" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref local="expDataBaseJob2" /> </property> <property name="cronExpression"> <value>0 * 16 * * ?</value> </property> </bean> <!-- 任务执行器配置 集合 --> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref local="expDataBaseTrigger" /> <ref local="expDataBaseTrigger2" /> </list> </property> </bean> </beans>
mrZhengxg 2012-11-10
  • 打赏
  • 举报
回复
配置添加<property name="concurrent" value="false"/> 如果是相同的JobDetail,必须one by one
Zeus 2012-11-09
  • 打赏
  • 举报
回复
spring3还是spring2 ??????????????
lemon520 2012-11-09
  • 打赏
  • 举报
回复
http://nesuk.iteye.com/blog/1582557
lemon520 2012-11-09
  • 打赏
  • 举报
回复
<property name="concurrent" value="false"/>
yjflinchong 2012-11-09
  • 打赏
  • 举报
回复
引用 1 楼 yjflinchong 的回复:
好像是有配置参数的。 忘了
这方面,咱是新手, 帮你顶下
yjflinchong 2012-11-09
  • 打赏
  • 举报
回复
好像是有配置参数的。 忘了

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧