Unable to store Trigger with name: 'trigger1' and group: 'group1', because one already exists with this identification

【转载】

https://stackoverflow.com/questions/25890202/unable-to-store-trigger-with-name-trigger1-and-group-group1-because-one-a

对trigger的key进行判断

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

 

posted @ 2020-04-15 09:40  不是少年也游荡  阅读(2090)  评论(0编辑  收藏  举报