
|
If you were logged in you would be able to see more operations.
|
|
|
|
|
| Component/s: |
None
|
| Affects Version/s: |
1.4.2
|
| Fix Version/s: |
1.4.3
|
|
|
When I create a CronTrigger and setting a start date to it (via trigger.startDate) which is in the past, and then adding a cron expression (via trigger.setCronExpression) like the following:
0 0 * * * ? *
...which means "execute every hour, every day", what I get is an execution "in the past" and then the real scheduling, waiting for the next hour (0 minutes) starting in the moment of execution.
I'll explain it with an example. I made a small simulator which executes a task which simply writes an asterisk ("*") on the standard output. The task gets scheduled and then the program enters an infinite while loop in which it asks for the next execution time every three seconds).
Here you can see this effect:
------------------
Date: 08 sep 2004 13:07:46
Trigger start date: 08 sep 2004 09:30:00
Trigger end date: 10 sep 2004 21:00:00
Trigger expression: 0 0 * * * ? *
Getting scheduler instance
Starting scheduler
Adding job to scheduler
Scheduling triggger
Entering loop...
(08 sep 2004 13:07:46) NEXT FIRE TIME: Wed Sep 08 10:00:00 CEST 2004
*
(08 sep 2004 13:07:49) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
(08 sep 2004 13:07:52) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
(08 sep 2004 13:07:55) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
(08 sep 2004 13:07:58) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
(08 sep 2004 13:08:01) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
...
------------------
As you can see, the first execution gets planned "out" of the scheduling, as the first execution should occur at "14:00".
This *does not happen* if the start date of the trigger is not in the past. In that case it works perfectly.
Thanks.
|
|
Description
|
When I create a CronTrigger and setting a start date to it (via trigger.startDate) which is in the past, and then adding a cron expression (via trigger.setCronExpression) like the following:
0 0 * * * ? *
...which means "execute every hour, every day", what I get is an execution "in the past" and then the real scheduling, waiting for the next hour (0 minutes) starting in the moment of execution.
I'll explain it with an example. I made a small simulator which executes a task which simply writes an asterisk ("*") on the standard output. The task gets scheduled and then the program enters an infinite while loop in which it asks for the next execution time every three seconds).
Here you can see this effect:
------------------
Date: 08 sep 2004 13:07:46
Trigger start date: 08 sep 2004 09:30:00
Trigger end date: 10 sep 2004 21:00:00
Trigger expression: 0 0 * * * ? *
Getting scheduler instance
Starting scheduler
Adding job to scheduler
Scheduling triggger
Entering loop...
(08 sep 2004 13:07:46) NEXT FIRE TIME: Wed Sep 08 10:00:00 CEST 2004
*
(08 sep 2004 13:07:49) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
(08 sep 2004 13:07:52) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
(08 sep 2004 13:07:55) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
(08 sep 2004 13:07:58) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
(08 sep 2004 13:08:01) NEXT FIRE TIME: Wed Sep 08 14:00:00 CEST 2004
...
------------------
As you can see, the first execution gets planned "out" of the scheduling, as the first execution should occur at "14:00".
This *does not happen* if the start date of the trigger is not in the past. In that case it works perfectly.
Thanks.
|
Show » |
|