开发者

Quartz CRON trigger not fired when expected

I have a simple quartz trigger running in Spring 2.5.6-SEC01.

Trigger definition looks like this:

<bean id="AdvicesCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail&quo开发者_如何学Got; ref="AdvicesQuartzJob"/>
    <property name="cronExpression" value="0 20/15 * * * ?"/>
</bean>

This is my scheduler factory:

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
        <list>
        <ref bean="AdvicesCronTrigger"/>
        </list>
    </property>
</bean>

I've read this documentation about firing CRON triggers from Quartz. This is an excerpt:

CronTrigger Example 1 - an expression to create a trigger that simply fires every 5 minutes

"0 0/5 * * * ?"

Today I fired my program at 9:40. This is my execution output:

Edit: Bobby is right in his appreciation. I've updatted my execution log:

2010-02-11 09:50:00,000 INFO - START

2010-02-11 10:20:00,000 INFO - START

2010-02-11 10:35:00,000 INFO - START

2010-02-11 10:50:00,000 INFO - START

2010-02-11 11:20:00,000 INFO - START

2010-02-11 11:35:00,000 INFO - START

I expected that this trigger will be fired at

9:50

10:05

10:20

10:35

...

How to accomplish this? Which CRON expression use?


The 20/15 part of the cron expression means every 15 minutes after the 20'th minute of the hour. This means that it will always start at the 20'th minute.

I have never tested it but maybe an expression like this one would be what you are searching for :
0 */15 * * * ?


Not to give you a non-related answer, but sometimes it makes sense to use some services instead of trying to do it yourself :) Take a look at http://www.cronservice.co.uk/new/, http://scheduler.codeeffects.com, or http://www.webbasedcron.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜