简体   繁体   English

Quartz Crone Scheduler结束时间

[英]Quartz Crone Scheduler end time

I'm trying to make this trigger run every 3 minutes between 8:15 and 9:45. 我正在尝试使此触发器在8:15和9:45之间每3分钟运行一次。 Is there a possible cron expression that could achive that? 是否有可能实现这一目标的cron表达式? If not, can there be more schedules for one trigger or do I just need more triggers? 如果不是,是否可以为一个触发器设置更多时间表,或者我是否只需要更多触发器?

        String startDateStr = "2017-10-01 00:00:00.0";
        String endDateStr = "2018-06-30 00:00:00.0";

        Date startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").parse(startDateStr);
        Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").parse(endDateStr);

        CronTrigger lesson1 = newTrigger()
                .withIdentity("lesson1", "Lessons")
                .startAt(startDate)
                .withSchedule(CronScheduleBuilder.cronSchedule("0 15/3 8 * * ? *").withMisfireHandlingInstructionDoNothing())
                .endAt(endDate)
                .forJob("Lesson1", "Lessons")
                .build();

Have you tried the following: 您是否尝试过以下方法:

0 15-45/3 8 * * ?   

EDIT: 编辑:

What about this one: 这个如何:

0 15-45/3 8-9 * * ? 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM