How is this Quartz Cron Expression executed
-
16-09-2019 - |
Question
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?
Solution 2
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
OTHER TIPS
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]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow