Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.amazonaws.services.simpleworkflow.flow.spring;
 
 import java.util.Date;
 
 import  org.springframework.scheduling.support.CronSequenceGenerator;
 
public class CronInvocationSchedule implements InvocationSchedule {
    protected static final int SECOND = 1000;
    private final CronSequenceGenerator cronSequenceGenerator;
    private final Date expiration;
    public CronInvocationSchedule(String cronExpressionDate expirationTimeZone timeZone) {
         = new CronSequenceGenerator(cronExpressiontimeZone);
        this. = expiration;
    }
    @Override
    public long nextInvocationDelaySeconds(Date currentTimeDate startTimeDate lastInvocationTimeint pastInvocatonsCount) {
        Date nextInvocationTime;
        if (lastInvocationTime == null) {
            nextInvocationTime = .next(startTime);
        }
        else {
            nextInvocationTime = .next(lastInvocationTime);
        }
        long resultMilliseconds = nextInvocationTime.getTime() - currentTime.getTime();
        if (resultMilliseconds < 0) {
            resultMilliseconds = 0;
        }
        if (currentTime.getTime() + resultMilliseconds >= .getTime()) {
            return .;
        }
        return resultMilliseconds / ;
    }
New to GrepCode? Check out our FAQ X