25

Is there a way to delete a scheduled trigger with a specific job? It seems that only way to delete a trigger is to delete the whole job and then re-register the job and trigger.

I've a job which can potentially have 100+ triggers and I really don't want to delete the job and re-register all the triggers when I just have to delete 1 trigger.

Also, is there a way to stop the scheduler from executing the job as soon as the trigger is configured?

Thanks

user140736
  • 1,913
  • 9
  • 32
  • 53

1 Answers1

41

try scheduler.unscheduleJob

this accepts the trigger and group names as a parameters and will only remove the trigger specified, not the job.

QuartzScheduler

Scheduler

Forum

pstanton
  • 35,033
  • 24
  • 126
  • 168
  • I tried doing getTriggersOfJob before and after doing unscheduleJob. It doesn't remove the trigger. Once I remove do I need to do something else to make the scheduler aware? – user140736 Dec 15 '09 at 21:46
  • 3
    The answers in the link are gone – maxisam Mar 22 '12 at 03:55
  • 4
    Just in case someone runs into the same issue that I had - The job WILL be removed unless you call the storeDurably() method when building it. i.e JobBuilder jobBuilder = new JobBuilder(), jobBuilder.storeDurably() – Travis Aug 05 '14 at 12:21
  • The job will not be removed if the job has any other triggers even if it is not configured durable. (at least for 2.3.2) – er-han Jan 11 '23 at 10:24