Commit 31f4bc85 authored by litengwei's avatar litengwei

重做添加定时器报错解决

parent 76b3bdb1
......@@ -32,10 +32,15 @@ public class QuartzManager {
.withIdentity(jobName, TRIGGER_GROUP_NAME) //给触发器起一个名字和组名
.withSchedule(CronScheduleBuilder.cronSchedule(time))
.build();
if(!sched.checkExists(jobDetail.getKey())) {
sched.scheduleJob(jobDetail, trigger);
if (!sched.isShutdown()) {
sched.start(); // 启动
}
System.out.println("定时器添加成功=========");
} else {
System.out.println("定时器已存在=========");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment