Search in sources :

Example 1 with SchedulingPattern

use of it.sauronsoftware.cron4j.SchedulingPattern in project ignite by apache.

the class ScheduleFutureImpl method nextExecutionTimes.

/**
 * {@inheritDoc}
 */
@Override
public long[] nextExecutionTimes(int cnt, long start) {
    assert cnt > 0;
    assert start > 0;
    if (isDone() || isCancelled())
        return EMPTY_TIMES;
    synchronized (mux) {
        if (maxCalls > 0)
            cnt = Math.min(cnt, maxCalls);
    }
    long[] times = new long[cnt];
    if (start < createTime() + delay * 1000)
        start = createTime() + delay * 1000;
    SchedulingPattern ptrn = new SchedulingPattern(cron);
    Predictor p = new Predictor(ptrn, start);
    for (int i = 0; i < cnt; i++) times[i] = p.nextMatchingTime();
    return times;
}
Also used : Predictor(it.sauronsoftware.cron4j.Predictor) SchedulingPattern(it.sauronsoftware.cron4j.SchedulingPattern)

Aggregations

Predictor (it.sauronsoftware.cron4j.Predictor)1 SchedulingPattern (it.sauronsoftware.cron4j.SchedulingPattern)1