[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Quartz scheduler and trigger issue  XML
Forum Index -> Quartz
Author Message
vraman

neo

Joined: 01/28/2010 20:23:25
Messages: 1
Offline

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
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


This is working exactly as designed. All scheduler nodes pointing at the same data store share the same set of data, and the cluster nodes will fire any trigger they get to before the other nodes.

You must have a separate set of db tables for each scheduler if you don't want them to share the scheduling data.

Also note that if do you point more than one scheduler instance at the same db, that you MUST set the quartz.property isClustered=true, or you will experience data corruption and/or weird behavior.

It is an occasionaly requested feature to be able to share the same set of tables for two distinct instances but this feature has thus far never been made.
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team