|
@@ -66,9 +66,9 @@ public class AlarmQuartzServiceImpl implements AlarmQuartzService {
|
|
|
log.error("执行时间【{}】为历史时间,继续添加", DateUtils.formatDate(startTime));
|
|
|
}
|
|
|
JobKey jobKey = new JobKey(jobName, jobGroupName);
|
|
|
- JobDetail jobDetail = JobBuilder.newJob(AlarmExpireJob.class).withIdentity(jobName, jobGroupName).requestRecovery().build();
|
|
|
+ JobDetail jobDetail = JobBuilder.newJob(AlarmExpireJob.class).withIdentity(jobKey).requestRecovery().build();
|
|
|
Trigger trigger = TriggerBuilder.newTrigger().startAt(startTime)
|
|
|
- .withIdentity("trigger_" + jobName , jobName)
|
|
|
+ .withIdentity("trigger_" + jobName , jobGroupName)
|
|
|
.usingJobData(jobDataMap)
|
|
|
.withSchedule(simpleSchedule().withMisfireHandlingInstructionIgnoreMisfires()).build();
|
|
|
//已经存在的job实例和触发器自动覆盖 job实 例 唯 一标识:
|
|
@@ -99,7 +99,10 @@ public class AlarmQuartzServiceImpl implements AlarmQuartzService {
|
|
|
@Override
|
|
|
public synchronized String deleteExpireJob(String jobName, String jobGroupName) throws SchedulerException {
|
|
|
JobKey jobKey = new JobKey(jobName, jobGroupName);
|
|
|
- quartzScheduler.deleteJob(jobKey);
|
|
|
+ boolean checkExists = quartzScheduler.checkExists(jobKey);
|
|
|
+ if (checkExists) {
|
|
|
+ quartzScheduler.deleteJob(jobKey);
|
|
|
+ }
|
|
|
return "success!";
|
|
|
}
|
|
|
|