Java – nested jobs in Quartz

javanestedquartz-schedulertimestamp

I have nested task to schedule:

(1). A daily master task downloading scheduling information, which is a List of job names with timestamps
(2). schedule the job in the scheduling information I just downloaded according to its timestamp

I am not sure how the nested jobs work in Quartz. It seems that I need a CronTrigger triggering a job, which contains multiple SimpleTriggered jobs. Are there any way to do that? Are there any alternatives?

Thanks.
Lily

Best Answer

They aren't really nested jobs.

You are correct in that the master job needs a CronTrigger. But when that job runs it will cycle through the list of jobs downloaded creating a job and a SimpleTrigger for each entry. You can get a Scheduler from the CronJob's JobExecutionContext and add the jobs to it.

And bingo, all your jobs are scheduled.