org.qi4j.library.scheduler
Interface Scheduler

All Known Subinterfaces:
SchedulerService
All Known Implementing Classes:
SchedulerMixin

@Concerns(value=UnitOfWorkConcern.class)
public interface Scheduler

Scheduler. This is the only interface you should use in your application for scheduling tasks. See SchedulerConfiguration for configuration properties. See in SchedulerAssembler how to assemble a Scheduler and optional Timeline. By default, a Schedule is not durable. In other words, it do not survive an Application restart. To make a Schedule durable, set it's durable property to true once its scheduled. Durable Schedules that have no future run are removed by SchedulerGarbageCollector.


Method Summary
 Schedule schedule(Task task, String cronExpression)
          Schedule a Task using a CronExpression.
 Schedule schedule(Task task, String cronExpression, Date start)
          Schedule a Task using a CronExpression starting at a given date.
 Schedule schedule(Task task, String cronExpression, long initialDelay)
          Schedule a Task using a CronExpression with a given initial delay in milliseconds.
 Schedule scheduleOnce(Task task, int initialSecondsDelay)
          Schedule a Task to be run after a given initial delay in seconds.
 

Method Detail

scheduleOnce

@UnitOfWorkPropagation(value=MANDATORY)
Schedule scheduleOnce(Task task,
                                                          int initialSecondsDelay)
Schedule a Task to be run after a given initial delay in seconds.

Parameters:
task - Task to be scheduled once
initialSecondsDelay - Initial delay the Task will be run after, in seconds
Returns:
The newly created Schedule

schedule

@UnitOfWorkPropagation(value=MANDATORY)
Schedule schedule(Task task,
                                                      String cronExpression)
Schedule a Task using a CronExpression.

Parameters:
task - Task to be scheduled once
cronExpression - CronExpression for creating the Schedule for the given Task
Returns:
The newly created Schedule

schedule

@UnitOfWorkPropagation(value=MANDATORY)
Schedule schedule(Task task,
                                                      String cronExpression,
                                                      long initialDelay)
Schedule a Task using a CronExpression with a given initial delay in milliseconds.

Parameters:
task - Task to be scheduled once
cronExpression - CronExpression for creating the Schedule for the given Task
initialDelay - Initial delay the Schedule will be active after, in milliseconds
Returns:
The newly created Schedule

schedule

@UnitOfWorkPropagation(value=MANDATORY)
Schedule schedule(Task task,
                                                      String cronExpression,
                                                      Date start)
Schedule a Task using a CronExpression starting at a given date.

Parameters:
task - Task to be scheduled once
cronExpression - CronExpression for creating the Schedule for the given Task
start - Date from which the Schedule will become active
Returns:
The newly created Schedule