阅读石英2.1文档并不能完全回答我的问题:-如何设置触发器,使每天仅在09:00至12:00之间每20分钟持续启动一次作业?
也许是startAt和endAt的结合?
trigger = newTrigger()
.withIdentity("trigger3", "group1")
.startAt(tomorrowAt(15, 0, 0) // first fire time 15:00:00 tomorrow
.withSchedule(simpleSchedule()
.withIntervalInHours(24) // interval is actually set at 24 hours' worth of milliseconds
.repeatForever())
.build()http://quartz-scheduler.org/documentation/quartz-2.1.x/cookbook/DailyTrigger
发布于 2014-05-04 11:43:48
你可以用Cron的表情。教程:http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-06
CronTrigger示例2-创建触发器的表达式,该触发器每5分钟触发一次,每分钟10秒钟(即上午10:00:10,上午10:05:10,等等)。 "10 /5*** ?“
还有一些站点可以帮助创建Cron表达式http://www.abunchofutils.com/utils/developer/cron-expression-helper/。
表达式*/20 9-11 * * *在9到12之间每20分钟触发一次,但它不会在12:00触发。
或者您可以使用DailyTimeIntervalScheduleBuilder
Trigger trigger = DailyTimeIntervalScheduleBuilder.dailyTimeIntervalSchedule()
.onEveryDay()
.startingDailyAt(TimeOfDay.hourAndMinuteOfDay(9, 0))
.endingDailyAt(TimeOfDay.hourAndMinuteOfDay(12, 0))
.withIntervalInMinutes(20)
.build();https://stackoverflow.com/questions/23455081
复制相似问题