Example usage for org.springframework.scheduling TriggerContext lastActualExecutionTime

List of usage examples for org.springframework.scheduling TriggerContext lastActualExecutionTime

Introduction

In this page you can find the example usage for org.springframework.scheduling TriggerContext lastActualExecutionTime.

Prototype

@Nullable
Date lastActualExecutionTime();

Source Link

Document

Return the last actual execution time of the task, or null if not scheduled before.

Usage

From source file:org.housecream.camel.solar.SolarConsumerRunner.java

@Override
public Date nextExecutionTime(TriggerContext triggerContext) {
    if (triggerContext.lastActualExecutionTime() == null) {
        nextEvent = calculator.findCurrentState();
    } else if (nextEvent != null && nextEvent.getEvent() != null) {
        nextEvent = new SolarState(nextEvent.getLatitude(), nextEvent.getLongitude(),
                nextEvent.getDate().plusMinutes(1), nextEvent.getPhase());
    } else {/*w  ww .j a  v a2  s.  com*/
        nextEvent = calculator.findNextEvent();
    }
    return nextEvent.getDate().toDate();
}

From source file:ru.retbansk.utils.scheduled.DynamicSchedule.java

/**
 * @return Date next execution of the schedule
 *///from w ww. j av  a 2s  .  c  om
@Override
public Date nextExecutionTime(TriggerContext triggerContext) {
    Date lastTime = triggerContext.lastActualExecutionTime();
    Date nextExecutionTime = (lastTime == null) ? new Date() : new Date(lastTime.getTime() + delay);
    logger.info("End of schedule. Next execution: " + nextExecutionTime + ". Delay is: "
            + getElapsedTimeHoursMinutesSecondsString(delay));
    return nextExecutionTime;
}