Referring delete trigger in quartz
I am getting the same issue: Unable to store Trigger with name: 'schedulerJobTrigger' and group: 'group1', because one already exists with this identification.
So before I think of unscheduling the Job I have a Query:
Say I have 2 jobs.. details as follows: Job1 : Start Time Today @ 17:30 and repeat twice after every 5 minutes Job 2 :Start Time Today @ 17:37
So if I unschedule a job(which supposedly removes the Trigger) after it executed at 17:30 and execute the Job2 then how will the scheduler run the Job1 which needs to be run @17:35 and 17:40 respectively(that's the repetitions)
Thanks, Please help!
Before trying the above scenario, even if I schedule a new job with a different schedule @ scheduler.scheduleJob(job, trigger); it gives me the exception: Unable to store Trigger with name: 'schedulerJobTrigger' and group: 'group1', because one already exists with this identification.
Solved, checked if the same trigger exists if yes, created a new trigger instance..with a different identity and run the code.
boolean flag = scheduler.checkExists(trigger.getKey());
if (!flag)
{
scheduler.start();
scheduler.scheduleJob(job, trigger);
}
else
{
Trigger trigger1 =TriggerBuilder.newTrigger().withIdentity("schedulerJobTrigger1", "group1").withSchedule(schedBuilder).build();;
scheduler.start();
scheduler.scheduleJob(job, trigger1);
}