public Date getEndDate(Date startDate, long period) {
        long now = getNow().getTime();
        long endDate = startDate.getTime() + period;
        if (now - period > endDate) {
            return new Date(endDate);
        } else {
            return null;
        }
    }
public Date getEndDate ( Date startDate , long period ) { long now = getNow ( ) . getTime ( ) ; long endDate = startDate . getTime ( ) + period ; if ( now - period > endDate ) { return new Date ( endDate ) ; } else { return null ; } }
Returns the end date given the start date end the period. The end date is
startDate+period, but only if endDate is at least one period ago. That
is, we always leave the last incomplete period unprocessed.

Override this to control the job generation algorithm