[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
quartz 1.6.5 Scheduler.deleteJob(jobName, groupName) doesn't delete job from table  XML
Forum Index -> Quartz
Author Message
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
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
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
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
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team