views:

36

answers:

1

Hi,

I am using a Quartz Cron trigger in my java program. The Cron expression I used is 0 0 * * * ?

Now I wanted a scheduler to execute once an hour. To test the same started my jboss server and after that I reset my windows time to something like 5:59:45 and at 6:00:00 the scheduler did not fire.

Now the next time I first adjusted the time to say 5:55:00 and then I started the server and lo the scheduler fired at 6:00:00.

Does the server or scheduler maintain time internally, of course initialized with system timing initially ??

+1  A: 

According to Quartz CronTrigger source code, the trigger retains the date of the next time it should fire.

I suppose that if you start the server at 6:15:00, Quartz retains 7:00:00 as the next firing time. Changing the server time to 5:55:45 doesn't update the next firing time, and 7:00:00 is retained as next firing time. So the event won't fire at 6:00:00, but instead at 7:00:00.

So, time isn't retained directly, but firing time is retained, and it appears it isn't updated if you change your system clock.

Vivien Barousse