History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QUARTZ-60
Type: Bug Bug
Status: Closed Closed
Resolution: Not A Problem
Priority: Major Major
Assignee: James House
Reporter: Jeff Petridis
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Quartz Scheduler

Cron trigger startTime not working as expected

Created: 02/Sep/04 03:20 AM   Updated: 03/Dec/04 03:11 PM
Component/s: Triggers
Affects Version/s: 1.4.2
Fix Version/s: 1.4.3

Environment: WebSphere v5.0


 Description  « Hide
Previously it was possible to schedule a cron job to start immediately, or at some specified time today, but now it seems Quartz ignores the startTime parameter and always calculates the first fire time as 00:00:00 the next day. Here is a sample trace output from the test excerpt below:

[2/09/04 15:58:33:718 EST] SchedulerHelper testJobGroup.testJob will run at: Fri Sep 03 00:00:00 EST 2004 & repeat using expression: 0/10 0 0 * * ?

To add to the mystery the job initialiser plug-in seems able to schedule cron jobs with an immediate start time!

public void testQuartzSchedulerCronJob() throws Exception
{
JobDataMap map = new JobDataMap();
map.put("testKey", "testValue");
long startMillis = System.currentTimeMillis();
SchedulerHelper schedulerHelper = new SchedulerHelper();

JobDetail job = new JobDetail("testJob", "testJobGroup", DummyJob1.class, false, true, true);
job.setJobDataMap(map);

CronTrigger cronTrigger = new CronTrigger("testTrigger", "testTriggerGroup", "testJob", "testJobGroup", "0/10 0 0 * * ?");
// Also unsuccessfully tried the following:
//CronTrigger cronTrigger = new CronTrigger("test2Trigger", "test2TriggerGroup", "test2Job", "test2JobGroup", new Date(), null, "0/10 0 0 ? * *");
//CronTrigger cronTrigger = new CronTrigger("test2Trigger", "test2TriggerGroup", "test2Job", "test2JobGroup", new Date(System.currentTimeMillis() + 10000), null, "0/10 0 0 ? * *");


scheduleTestTrigger(cronTrigger, monitor);
Date date = SchedulerHelper.getScheduler().scheduleJob(job, cronTrigger);
logger.info(job.getFullName() + " will run at: " + date + " & repeat using expression: " + cronTrigger.getCronExpression());
}


 All   Comments   Change History      Sort Order:
James House - [03/Dec/04 03:11 PM ]
...your expression is explicitly choosing to 'jump' to hour zero, because of the '0' in the hour position of the expression you're using. I you want it to start firing immediately (for all hours), set the hour to "*".