Failed to save trigger with name: "trigger1" and group: "group1" because it already exists with this identifier

Link delete trigger in quartz

I have the same problem: Failed to save the trigger with the name: "schedulerJobTrigger" and group: "group1" because it already exists with this identifier.

So, before I think about unplanned tasks, I have a request:

Say I have 2 jobs .. more info: Job1: Start time Today @ 17:30 and repeat twice every 5 minutes Job 2: Start time Today @ 17: 37

So, if I canceled a task (which is supposed to delete the trigger) after it is completed at 17:30 and will execute Job2, while the scheduler will execute Job1, which should be started at 17:35 and 17:40, respectively (which is a repetition)

Thanks, please help!

Before I try the script described above, even if I am planning a new task with a different schedule @ scheduler.scheduleJob (task, trigger); this gives me an exception: it is not possible to save a trigger with the name: "schedulerJobTrigger" and group: "group1" because it already exists with this identifier.

+4
source share
1 answer

, , , , .. .

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);
}
+4

All Articles