views:

2288

answers:

2

I have a the following;

private String cronExpression = "";
private final String jobID = "MyJObID";
...
Scheduler scheduler = ServiceLocator.getInstance().getScheduler();
CronTrigger trigger = new CronTrigger(jobID , Scheduler.DEFAULT_GROUP, cronExpression);
JobDetail jobDetail = new JobDetail(jobID , Scheduler.DEFAULT_GROUP, MyJob.class);
scheduler.scheduleJob(jobDetail, trigger);

My question is when is this job triggered for the empty cron expression?

+1  A: 

Are you sure it works?

Just by looking at the org.quartz.CronExpression#buildExpression() method code it looks like an exception should be thrown:

        if (exprOn <= DAY_OF_WEEK) {
            throw new ParseException("Unexpected end of expression.",
                        expression.length());
        }

      // exprOn should be equal to SECOND in case of empty String given

[checked in Quartz 1.6.0]

Grzegorz Oledzki
yes it does, using Quartz 1.5.1
n002213f
FWIW its sent every morning at 8am
n002213f
Looking at the source of Quartz 1.5.1 (this time it's CronTrigger.buildExpression()) the same exception is thrown there. Have you tried to debug and set a breakpoint somewhere there?
Grzegorz Oledzki
A: 

Thanks for the help guys, found the issue.

After some night of searching i found out that the class was registered in JBoss as a MBean and a value for the cron expression attribute was set to some meaningful value in the deployment descriptor

Sigh

n002213f