Hi
Background of application
Our Online and Batch application makes use of quartz scheduler for executing scheduled task.
Online application makes use of Simple trigger to schedule quartz event while Batch makes use of cron expression. The Quartz job are persisted in database(we have opted for JDBC store). Quartz.properties for both Online and Batch application points to same schema.Both Online as well as batch application has its own scheduler instance running
Sample code snippet on how quartz job is scheduled for Batch application below
Code:
SchedulerFactory schedFactory = new org.quartz.impl.StdSchedulerFactory();
Scheduler scheduler = schedFactory.getScheduler();
scheduler.start();
JobDetail jobDetail = new JobDetail(
ICFDataToolsBatchConstants.JOB_DETAILS,
"BatchGroupName", IABListUpdateBatchJob.class);
jobDetail.getJobDataMap().put(ICFDataToolsBatchConstants.ICF_BATCH_JAR,
args[0]);
// will be triggered at 20:30 on a daily basis
Trigger trigger = new CronTrigger(
ICFDataToolsBatchConstants.TRIGGER,
"BatchGroupName", "0 30 20 * * ? *");
scheduler.scheduleJob(jobDetail, trigger);
The Job Groupname/Trigger Group name for Batch and online application are different( "BatchGroupName" for batch and "OnlineGroupName" for online application
Issue
In case both Online and Batch application have different triggers(quartz job/event/trigger) scheduled at the same time, batch scheduler picks the Quartz trigger of Online app as well and is throwing NoClassDefFound error
Observation
What we have observed id scheduler is not getting tied to specific/specific set of triggers
WorkAround
When we have quatz.properties of online app and batch app pointing to different schemas, we are not facing any issues. But client had communicated that this is not a scalable solution
It is possible to add the class that the batch is expecting in the classpath, but the issue is
(1)It is inappropriate for the Batch scheduler to run the Online trigger
(2)Online and Bath run in seperate JVM, therefore if Batch scheduler were to pick online trigger, the scope/lifetime of variables will be under question
ClarificationPlease let us know of any approach to get around this issue. Would it be possible to associate particular scheduler instance with specific/specific set of quartz triggers? Please help
Quartz version used
1.6.5
Thanks,
Vijay