public interface SchedulerService extends OpenmrsService
Modifier and Type | Method and Description |
---|---|
void |
deleteTask(Integer id)
Delete the task with the given identifier.
|
Collection<TaskDefinition> |
getRegisteredTasks()
Get the list of tasks that are available to be scheduled.
|
Collection<TaskDefinition> |
getScheduledTasks()
Get scheduled tasks.
|
String |
getStatus(Integer id)
Checks the status of a scheduled task.
|
SortedMap<String,String> |
getSystemVariables()
Return SchedulerConstants
|
TaskDefinition |
getTask(Integer id)
Get the task with the given identifier.
|
TaskDefinition |
getTaskByName(String name)
Get the task with the given name.
|
TaskDefinition |
getTaskByUuid(String uuid) |
void |
onShutdown()
Stop all tasks and clean up the scheduler instance.
|
void |
onStartup()
Start all tasks that are scheduled to run on startup.
|
void |
rescheduleAllTasks()
Loop over all currently started tasks and cycle them.
|
Task |
rescheduleTask(TaskDefinition task)
Stop and start a scheduled task.
|
void |
restoreFromMemento(OpenmrsMemento memento)
Restore the scheduler service to state defined by Memento
|
void |
saveTaskDefinition(TaskDefinition task)
Create the given task
|
OpenmrsMemento |
saveToMemento()
Save the state of the scheduler service to Memento
|
void |
scheduleIfNotRunning(TaskDefinition taskDef)
Schedules a task for execution if not already running
|
Task |
scheduleTask(TaskDefinition task)
Start a scheduled task as specified in a TaskDefinition.
|
void |
shutdownTask(TaskDefinition task)
Cancel a scheduled task.
|
@Authorized(value="Manage Scheduler") String getStatus(Integer id)
id
- String
status of the task with the given identifier@Authorized(value="Manage Scheduler") void onStartup()
onStartup
in interface OpenmrsService
@Authorized(value="Manage Scheduler") void onShutdown()
onShutdown
in interface OpenmrsService
@Authorized(value="Manage Scheduler") void shutdownTask(TaskDefinition task) throws SchedulerException
task
- the TaskDefinition
for the task to cancelSchedulerException
@Authorized(value="Manage Scheduler") Task scheduleTask(TaskDefinition task) throws SchedulerException
task
- TaskDefinition to startTask
, or null if there was a problem instantiating or
scheduling the taskSchedulerException
@Authorized(value="Manage Scheduler") Task rescheduleTask(TaskDefinition task) throws SchedulerException
task
- the TaskDefinition
to rescheduleSchedulerException
@Authorized(value="Manage Scheduler") void rescheduleAllTasks() throws SchedulerException
SchedulerException
@Authorized(value="Manage Scheduler") Collection<TaskDefinition> getScheduledTasks()
@Authorized(value="Manage Scheduler") Collection<TaskDefinition> getRegisteredTasks()
@Authorized(value="Manage Scheduler") TaskDefinition getTask(Integer id)
id
- the identifier of the task@Authorized(value="Manage Scheduler") TaskDefinition getTaskByUuid(String uuid)
uuid
- the unique identifier of the task@Authorized(value="Manage Scheduler") TaskDefinition getTaskByName(String name)
name
- name of the task@Authorized(value="Manage Scheduler") void deleteTask(Integer id)
id
- the identifier of the task@Authorized(value="Manage Scheduler") @Logging(ignore=true) void saveTaskDefinition(TaskDefinition task)
task
- the task to be created
Should save task to the databaseSortedMap<String,String> getSystemVariables()
OpenmrsMemento saveToMemento()
void restoreFromMemento(OpenmrsMemento memento)
memento
- void scheduleIfNotRunning(TaskDefinition taskDef)
taskDef
- Copyright © 2024 OpenMRS Inc.. All rights reserved.