Reputation: 15844
I have a strange problem with task scheduler. Here are three tested configurations of pingProducer
in my appliacationContext.xml
. The first and the second work. The third, which should produce the ping every hour, doesn't - it produces the ping every minute. Am I missing something?
<!-- Ping scheduler - WORKS - every second -->
<task:scheduled-tasks>
<task:scheduled ref="pingProducer" method="producePingRequest" cron="* * * * * ?" />
</task:scheduled-tasks>
<!-- Ping scheduler - WORKS - every minute -->
<task:scheduled-tasks>
<task:scheduled ref="pingProducer" method="producePingRequest" cron="0 * * * * ?" />
</task:scheduled-tasks>
<!-- Ping scheduler - DOES NOT WORK - every minute -->
<task:scheduled-tasks>
<task:scheduled ref="pingProducer" method="producePingRequest" cron="0 0 * * * ?" />
</task:scheduled-tasks>
Upvotes: 0
Views: 1869
Reputation: 752
<task:scheduled-tasks>
<task:scheduled ref="pingProducer" method="producePingRequest" cron="0 0 0/1 * * ?" />
</task:scheduled-tasks>
cron="0 0 0/1 * * ?" works because 0/x means run after every x hour from 0 o'clock.
Upvotes: 0
Reputation: 9265
Change to:
<task:scheduled-tasks>
<task:scheduled ref="pingProducer" method="producePingRequest" cron="50 0 * * * ?" />
</task:scheduled-tasks>
EDIT: once per hour, on the 50th second
Upvotes: 2