[jboss-user] [Beginners Corner] - Using same job class in Quartz scheduler

ramboid do-not-reply at jboss.com
Mon Dec 8 11:00:11 EST 2008


How can I use the same class as a quartz job in Quartz?  I am creating quartz jobs with the quartz implementaion of  JBoss 4.2.3.GA.  From a web object I add the job to the scheduler and create the cron.  I add the job class name in the job detail as follows:
org.quartz.JobDetail jd = new org.quartz.JobDetail("myjob",sched.DEFAULT_GROUP, NewJob.class);
I want to use the same job class (NewJob.class) with different parameters in the job detail and add it to the scheduler with a adifferent cron trigger but Quartz errors out saying that the class is already in use.  I must create a copy of the job class with a different name and then I can successfuly schedule the jobs.  The job class is just calling different web objects depending on the parameters of the job detail but the code of the class is the same in the two copies of the job class.  I want to avoid creating the same class with different names everytime that I have to schedule one of these calls.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4195093#4195093

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4195093



More information about the jboss-user mailing list