public interface TaskService
TaskServiceBuilder for details on creating and
configuring a TaskService. Note that there is currently only support for repeating tasks. Support will be added for
non-repeated, single execution tasks.| Modifier and Type | Method and Description |
|---|---|
rx.Observable<Task> |
scheduleTask(org.joda.time.DateTime time,
Task task)
Schedules the task for repeated execution starting in the next time slice after
time. |
void |
shutdown()
Shuts down the internal scheduler.
|
void |
start()
Starts the internal scheduler which takes care of running jobs to process the task queue.
|
void start()
scheduleTask(DateTime, Task).void shutdown()
rx.Observable<Task> scheduleTask(org.joda.time.DateTime time, Task task)
Schedules the task for repeated execution starting in the next time slice after time. If the task
scheduler runs jobs for executing tasks every minute and if time is 13:01:22, then the earliest
that the task can first get scheduled to execute is at 13:02 and every minute there after. Execution times are
determined by Task.getInterval(). If the task has an interval of 30 minutes, then it would be scheduled
to run at 13:30, 14:00, 14:30, and so on.
The task is guaranteed to execute at its scheduled time or later, and only one instance of the task will be executed at a time for a given time slice. In other words, if there are 5 machines running TaskService, only one of those TaskService instances will execute the task for a particular time slice.
If task execution fails for whatever reason, it will be rescheduled for execution in the next time slice. If the task runs at 13:30 and fails with some unhandled exception, then TaskService will run the task twice at 14:00. It will first run the task for the 13:30 time slice and then for the 14:00 time slice.
time - The starting time from which the initial execution is scheduled. The scheduled execution time depends
on Task.getInterval(). Tasks are scheduled to execute on fixed time boundaries. For example,
if the task has an interval of 15 minutes, then it will get scheduled to run at 14:00, 14:15, 14:30,
14:45, 15:00, and so on.task - The task to schedule for executionscheduled execution time setCopyright © 2014–2015 Red Hat, Inc.. All rights reserved.