quartzJob
定时任务的时间修改、暂停、立即执行
定时任务的修改、暂停主要是调用quartz内置方法pauseJob()、resumeJob()、triggerJob()等方法
//暂停一个job
JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
scheduler.pauseJob(jobKey);
// 恢复一个定时任务
JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
scheduler.resumeJob(jobKey);
// 立即执行一个定时任务
JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
scheduler.triggerJob(jobKey);
// 更新时间表达式
TriggerKey triggerKey = TriggerKey.triggerKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
CronScheduleBuilder scheduleBuilder =
CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression());
trigger = trigger.getTriggerBuilder()
.withIdentity(triggerKey)
.build();
scheduler.rescheduleJob(triggerKey,trigger);