动态修改Spring定时器的频率/时间
//String cronExpression = "0/"+String.valueOf(time)+" * * * * ?";
//System.out.println("=========修改定时器频率=========:"+cronExpression);
try {
trigger = (CronTrigger) birthdayMessageScheduler
.getTrigger("cronTrigger", Scheduler.DEFAULT_GROUP);
try {
trigger.setCronExpression(cronExpression);
birthdayMessageScheduler
.rescheduleJob("cronTrigger", Scheduler.DEFAULT_GROUP,
trigger);
} catch (java.text.ParseException e) {
throw new LmsBaseException("id", "失败!");
}
} catch (SchedulerException e) {
throw new LmsBaseException("id", "失败!");
}
}