Exemplo n.º 1
0
 @Override
 public Schedule scheduleCron(
     Task task, @CronExpression String cronExpression, DateTime start, boolean durable) {
   Schedule schedule = scheduleFactory.newCronSchedule(task, cronExpression, start, durable);
   if (durable) {
     Schedules schedules =
         module.currentUnitOfWork().get(Schedules.class, getSchedulesIdentity(me));
     schedules.schedules().add(schedule);
   }
   dispatchForExecution(schedule);
   return schedule;
 }
Exemplo n.º 2
0
 @Override
 public Schedule scheduleCron(
     Task task, String cronExpression, long initialDelay, boolean durable) {
   DateTime start = new DateTime(System.currentTimeMillis() + initialDelay);
   Schedule schedule = scheduleFactory.newCronSchedule(task, cronExpression, start, durable);
   if (durable) {
     Schedules schedules =
         module.currentUnitOfWork().get(Schedules.class, getSchedulesIdentity(me));
     schedules.schedules().add(schedule);
   }
   dispatchForExecution(schedule);
   return schedule;
 }