Search in sources :

Example 1 with SaturnScheduler

use of com.vip.saturn.job.trigger.SaturnScheduler in project Saturn by vipshop.

the class JobScheduler method getNextFireTimePausePeriodEffected.

/**
 * 获取下次作业触发时间.可能被暂停时间段所影响。
 *
 * @return 下次作业触发时间
 */
public Date getNextFireTimePausePeriodEffected() {
    SaturnScheduler saturnScheduler = job.getScheduler();
    if (saturnScheduler == null) {
        return null;
    }
    Trigger trigger = saturnScheduler.getTrigger();
    if (trigger == null) {
        return null;
    }
    ((OperableTrigger) trigger).updateAfterMisfire(null);
    Date nextFireTime = trigger.getNextFireTime();
    while (nextFireTime != null && configService.isInPausePeriod(nextFireTime)) {
        nextFireTime = trigger.getFireTimeAfter(nextFireTime);
    }
    if (null == nextFireTime) {
        return null;
    }
    return nextFireTime;
}
Also used : SaturnScheduler(com.vip.saturn.job.trigger.SaturnScheduler) OperableTrigger(org.quartz.spi.OperableTrigger) Trigger(org.quartz.Trigger) OperableTrigger(org.quartz.spi.OperableTrigger) Date(java.util.Date)

Aggregations

SaturnScheduler (com.vip.saturn.job.trigger.SaturnScheduler)1 Date (java.util.Date)1 Trigger (org.quartz.Trigger)1 OperableTrigger (org.quartz.spi.OperableTrigger)1