@Transactional 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.
|
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 |
saveTask(TaskDefinition task)
Create the given task
|
OpenmrsMemento |
saveToMemento()
Save the state of the scheduler service to Memento
|
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") @Transactional(readOnly=true) Collection<TaskDefinition> getScheduledTasks()
@Authorized(value="Manage Scheduler") @Transactional(readOnly=true) Collection<TaskDefinition> getRegisteredTasks()
@Authorized(value="Manage Scheduler") @Transactional(readOnly=true) TaskDefinition getTask(Integer id)
id
- the identifier of the task@Authorized(value="Manage Scheduler") @Transactional(readOnly=true) 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 saveTask(TaskDefinition task)
task
- the task to be created@Transactional(readOnly=true) SortedMap<String,String> getSystemVariables()
OpenmrsMemento saveToMemento()
void restoreFromMemento(OpenmrsMemento memento)
memento
- Copyright © 2018 OpenMRS LLC.. All Rights Reserved.