I am using this statement -
trigger2 = TriggerBuilder.newTrigger()
.withIdentity("abc", "group1")
.withSchedule(CronScheduleBuilder
.cronSchedule("0/30 0 14-23 * * ?"))
.build();
Somehow the trigger is fired at 2 pm, 2:00:30 pm and no more. What is the problem?
The problem is that you have put 0 in the minute field.So it fires only at 2:00. Try
trigger2 = TriggerBuilder
.newTrigger()
.withIdentity("abc", "group1")
.withSchedule(
CronScheduleBuilder.cronSchedule("0/30 * 14-23 * * ?"))
.build();
From quartz scheduler documentation I extracted the following example:
Job #1 is scheduled to run every 20 seconds
JobDetail job = new JobDetail("job1", "group1", SimpleJob.class);
CronTrigger trigger = new CronTrigger("trigger1", "group1", "job1", "group1", "0/20 * * * * ?");
sched.addJob(job, true);
Adapting to your situation it should go like this:
CronTrigger trigger = new CronTrigger("trigger1", "group1", "job1", "group1", "0/30 * 14-23 * * ?");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.