我正在使用Quartz:
schedulerFactory = new StdSchedulerFactory();
scheduler = schedulerFactory.getScheduler();
JobDetail startECMSJob = new JobDetail("startECMSJob", "group1", StartECMSJob.class);
Trigger trigger = TriggerUtils.makeMinutelyTrigger(30);
trigger.setName("TriggersGroup1");
trigger.setGroup("group1");
scheduler.scheduleJob(startECMSJob, trigger);
scheduler.start();
问题是Quartz直接开始部署。我确实希望它在部署后仅开始30分钟。 当我重新考虑它时,同样的态度。我不希望它在重新安排时立即开始。
重新安排代码:
//JobDetail startECMSJob = new JobDetail("startECMSJob", "group1", StartECMSJob.class);
JobDetail jobDetail=jobContext.getJobDetail();
Trigger trigger = TriggerUtils.makeSecondlyTrigger(30);
trigger.setName("aa");
trigger.setGroup("group1");
trigger.setJobName(jobContext.getJobDetail().getName());
trigger.setJobGroup(jobContext.getJobDetail().getGroup());
Scheduler scheduler = jobContext.getScheduler();
scheduler.rescheduleJob("TriggersGroup1", "group1", trigger);
任何想法如何选择第一个触发器? 谢谢, 射线。
答案 0 :(得分:3)
trigger.setStartTime(new Date(System.currentTimeMillis() + 30 * 60 * 1000));