简体   繁体   English

Cron Expression每月工作

[英]Cron Expression for monthly job

I want run scheduler job 14th of each month, if this day falls on a weekend, scheduler job should be day prior to this day. 我想在每个月的14号运行调度程序作业,如果这一天是周末,调度程序作业应该在这一天的前一天。 What is the cron expression for this?. cron表达式是什么?

I'm guessing you could extend CronTriggerImpl to create a NotOnWeekendsCronTrigger . 我猜您可以扩展CronTriggerImpl来创建NotOnWeekendsCronTrigger Eg: 例如:

public class NotOnWeekendsCronTrigger extends CronTriggerImpl {
    public Date getFireTimeAfter(Date afterTime) {
       return weekdayBefore(super.getFireTimeAfter(afterTime));
    }
    public Date getNextFireTime() {
       return weekdayBefore(super.getNextFireTime());
    }
    protected Date weekdayBefore(Date date) {
       // TODO implement
    }
    // etc etc
}

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

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