| Author |
Message |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 07/13/2011 16:41:49
|
fearful
neo
Joined: 07/06/2011 21:45:21
Messages: 4
Offline
|
Hi,
I am using quartz 1.6.5, jdbc jobstore. I configured jdbc jobstore clustering.
Here is the code to add cron job:
StdSchedulerFactory schedFact;
Scheduler sched;
schedFact = new StdSchedulerFactory("cronJob_quartz.properties");
sched = schedFact.getScheduler();
JobDetail jd = new JobDetail(jobId, GROUP_NAME, MyBusinessEvent.class);
JobDataMap dataMap = new JobDataMap();
dataMap.put("jobId", id);
dataMap.put("cronExpr", cronExpr);
jd.setJobDataMap(dataMap);
// cluster setting, quartz job failover
jd.setRequestsRecovery(true);
CronTrigger cronTrigger = new CronTrigger(jobId, GROUP_NAME);
cronTrigger.setCronExpression(cronExpr);
sched.scheduleJob(jd, cronTrigger);
sched.start();
after monitor cron job get kicked off at every regular interval, job and trigger are saved in related DB tables.
Then i use the below code to delete job from scheduler:
schedFact = new StdSchedulerFactory("cronJob_quartz.properties");
sched = schedFact.getScheduler();
sched.deleteJob(jobId, this.GROUP_NAME);
No any error but after a while, the job still get kicked off and related rows still stuck in db tables, never get deleted.
It's version 1.6.5. Is it the right way to do this? Anything else need to do or config?
Appreciate any help and comment on this issue.
Thanks in advance.
Julia
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 07/13/2011 17:40:00
|
gkeim
ophanim
Joined: 12/05/2006 10:22:37
Messages: 685
Location: Terracotta, Inc.
Offline
|
Is jobId a variable or a string? In one place you have "jobId" and in another just jobId.
|
Gary Keim (terracotta developer) Want to post to this forum? Join the Terracotta Community |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 07/13/2011 22:25:34
|
fearful
neo
Joined: 07/06/2011 21:45:21
Messages: 4
Offline
|
gkeim wrote:
Is jobId a variable or a string? In one place you have "jobId" and in another just jobId.
Hi, jobId is the variable that is a unique id. i did some change to simplify the code when post here.
is it the right way to delete job for clustering jdbc jobstore?
Thanks
Julia
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 07/14/2011 11:56:25
|
gkeim
ophanim
Joined: 12/05/2006 10:22:37
Messages: 685
Location: Terracotta, Inc.
Offline
|
Yes, that is the correct method to call. It returns a boolean indicating if it was successful. It firsts unschedules the job before removing it.
|
Gary Keim (terracotta developer) Want to post to this forum? Join the Terracotta Community |
|
|
 |
|
|