diff --git a/ConfigurationScheduler.java b/ConfigurationScheduler_patched.java index 55cd74a..b5d39d8 100644 --- a/ConfigurationScheduler.java +++ b/ConfigurationScheduler_patched.java @@ -111,11 +111,12 @@ public class ConfigurationScheduler extends AbstractLifeCycle { /** * Creates and executes an action that first based on a cron expression. * @param cronExpression the cron expression describing the schedule. + * @param startDate the date to start the scheduling from * @param command The Runnable to run, * @return a ScheduledFuture representing the next time the command will run. */ - public CronScheduledFuture scheduleWithCron(final CronExpression cronExpression, final Runnable command) { - final Date fireDate = cronExpression.getNextValidTimeAfter(new Date()); + public CronScheduledFuture scheduleWithCron(final CronExpression cronExpression, final Date startDate, final Runnable command) { + final Date fireDate = cronExpression.getNextValidTimeAfter(startDate); final CronRunnable runnable = new CronRunnable(command, cronExpression); final ScheduledFuture future = schedule(runnable, nextFireInterval(fireDate), TimeUnit.MILLISECONDS); final CronScheduledFuture cronScheduledFuture = new CronScheduledFuture<>(future, fireDate);