/** * Returns the next time at which this job will be executed, after the given time. * * <p>If this job will not be executed after the given time, <code>null</code> will be returned.. * * <p> * * @param date the after which the next execution time should be calculated * @return the next time at which this job will be executed, after the given time */ public Date getExecutionTimeAfter(Date date) { if (!m_active || (m_trigger == null)) { // if the job is not active, no time can be calculated return null; } return m_trigger.getFireTimeAfter(date); }
private List<DateTime> getFireTimes(String key) throws SchedulerException { Trigger trigger = scheduler.getTrigger(triggerKey(key, "default")); List<DateTime> fireTimes = new ArrayList<>(); Date nextFireTime = trigger.getNextFireTime(); while (nextFireTime != null) { fireTimes.add(newDateTime(nextFireTime)); nextFireTime = trigger.getFireTimeAfter(nextFireTime); } return fireTimes; }
@Override public void visit(FixedPeriodJobTrigger trigger) { switch (trigger.getTimeUnit()) { case SECOND: quartzTrigger = TriggerUtils.makeSecondlyTrigger(trigger.getTimeInterval()); break; case MINUTE: quartzTrigger = TriggerUtils.makeMinutelyTrigger(trigger.getTimeInterval()); break; case HOUR: quartzTrigger = TriggerUtils.makeHourlyTrigger(trigger.getTimeInterval()); break; } if (trigger.getStartDate() != null) { quartzTrigger.setStartTime(trigger.getStartDate()); } else { quartzTrigger.setStartTime(quartzTrigger.getFireTimeAfter(new Date())); } }