[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
startAt  XML
Forum Index -> Quartz
Author Message
buj

neo

Joined: 03/29/2012 06:04:01
Messages: 9
Offline

Hi,

"Set the time the Trigger should start at - the trigger may or may not fire at this time - depending upon the schedule configured for the Trigger." stands in Javadoc for startAt(Date date). How can i configure my scheduler in ordet to prevent that my trigger fires at this time???

Thanks in advance.
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1654
Offline


If "now" is 10:00:00 am on Thursday March 1, 2012.

And "start time" for a trigger is set to 2:00:00 pm on Friday March 16, 2012.

And the trigger is a CronTrigger with expression "0 0 13 ? * FRI *" (every Friday at 1:00 pm).

THEN: the first firing of the trigger will be computed to be 1:00 pm on Friday March 23.
buj

neo

Joined: 03/29/2012 06:04:01
Messages: 9
Offline

My code:
Code:
 DateFormat format=new SimpleDateFormat("dd.MM.yyyy");
 Date start = format.parse("29.03.2012"); // you can set 30.03.2012 or 31...
 
 Trigger trigger = newTrigger().withIdentity("MyTrigger","MyGroup").startAt(start).withSchedule(cronSchedule("0 45 7-19/4 * * ?").build();
 

It will immediately fire at start!!! Why???????? It should only fire each 4 hours between 7 and 19 at 45 min and not immediately at start. You can try it. How can I preven this????
buj

neo

Joined: 03/29/2012 06:04:01
Messages: 9
Offline

I have found, if I start e.g. 30.03.2012 at 9:30 and my startAtDate is e.g 30.03.2012 9:35 (later), then my trigger fires neither at 9:30 nor at 9:35, but in agreement with cron expression!!!

But why should I always adapt my startAtDate?
I don't simply want that my trigger fires at program start. Is this problem resolvable?
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team