@Concerns(value=org.qi4j.api.unitofwork.concern.UnitOfWorkConcern.class)
public interface 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 (not implemented?).
| Modifier and Type | Method and Description |
|---|---|
Schedule |
scheduleCron(Task task,
String cronExpression,
boolean durable)
Schedule a Task using a CronExpression.
|
Schedule |
scheduleCron(Task task,
String cronExpression,
DateTime start,
boolean durable)
Schedule a Task using a CronExpression starting at a given date.
|
Schedule |
scheduleCron(Task task,
String cronExpression,
long initialDelay,
boolean durable)
Schedule a Task using a CronExpression with a given initial delay in milliseconds.
|
Schedule |
scheduleOnce(Task task,
DateTime runAt,
boolean durable)
Schedule a Task to be run after a given initial delay in seconds.
|
Schedule |
scheduleOnce(Task task,
int initialSecondsDelay,
boolean durable)
Schedule a Task to be run after a given initial delay in seconds.
|
@UnitOfWorkPropagation(value=MANDATORY) Schedule scheduleOnce(Task task, int initialSecondsDelay, boolean durable)
task - Task to be scheduled onceinitialSecondsDelay - Initial delay the Task will be run after, in secondsdurable - true if this Schedule should survive a restart.@UnitOfWorkPropagation(value=MANDATORY) Schedule scheduleOnce(Task task, DateTime runAt, boolean durable)
task - Task to be scheduled oncerunAt - The future point in time when the Schedule will be run.durable - true if this Schedule should survive a restart.@UnitOfWorkPropagation(value=MANDATORY) Schedule scheduleCron(Task task, String cronExpression, boolean durable)
task - Task to be scheduled oncecronExpression - CronExpression for creating the Schedule for the given Taskdurable - true if this Schedule should survive a restart.@UnitOfWorkPropagation(value=MANDATORY) Schedule scheduleCron(Task task, String cronExpression, long initialDelay, boolean durable)
task - Task to be scheduled oncecronExpression - CronExpression for creating the Schedule for the given TaskinitialDelay - Initial delay the Schedule will be active after, in millisecondsdurable - true if this Schedule should survive a restart.@UnitOfWorkPropagation(value=MANDATORY) Schedule scheduleCron(Task task, String cronExpression, DateTime start, boolean durable)
task - Task to be scheduled oncecronExpression - CronExpression for creating the Schedule for the given Taskstart - Date from which the Schedule will become activedurable - true if this Schedule should survive a restart.