public class TimerSchedulerServiceImpl extends BaseOpenmrsService implements SchedulerService
| Constructor and Description |
|---|
TimerSchedulerServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteTask(Integer id)
Delete the task with the given identifier.
|
Collection<TaskDefinition> |
getRegisteredTasks()
Get all registered tasks.
|
Collection<TaskDefinition> |
getScheduledTasks()
Get all scheduled tasks.
|
SchedulerDAO |
getSchedulerDAO()
Gets the scheduler data access object.
|
String |
getStatus(Integer id)
Checks the status of a scheduled task.
|
SortedMap<String,String> |
getSystemVariables()
Get system variables.
|
TaskDefinition |
getTask(Integer id)
Get the task with the given identifier.
|
TaskDefinition |
getTaskByName(String name)
Get the task with the given name.
|
void |
onShutdown()
Shutdown hook for the scheduler and all of its scheduled tasks.
|
void |
onStartup()
Start up hook for the scheduler and all of its scheduled tasks.
|
void |
registerTask(TaskDefinition definition)
Register a new task by adding it to our task map with an empty schedule map.
|
void |
rescheduleAllTasks()
Loop over all currently started tasks and cycle them.
|
Task |
rescheduleTask(TaskDefinition taskDefinition)
Stop and start a scheduled task.
|
void |
restoreFromMemento(OpenmrsMemento memento)
Restore the scheduler service to state defined by Memento
|
void |
saveTask(TaskDefinition task)
Save a task in the database.
|
OpenmrsMemento |
saveToMemento()
Saves and stops all active tasks
|
Task |
scheduleTask(TaskDefinition taskDefinition)
Schedule the given task according to the given schedule.
|
void |
setSchedulerDAO(SchedulerDAO dao)
Sets the scheduler data access object.
|
void |
shutdownAllTasks()
Shutdown all running tasks.
|
void |
shutdownTask(TaskDefinition taskDefinition)
Stops a running task.
|
public SchedulerDAO getSchedulerDAO()
public void setSchedulerDAO(SchedulerDAO dao)
public void onStartup()
onStartup in interface OpenmrsServiceonStartup in interface SchedulerServiceonStartup in class BaseOpenmrsServiceOpenmrsService.onStartup()public void onShutdown()
onShutdown in interface OpenmrsServiceonShutdown in interface SchedulerServiceonShutdown in class BaseOpenmrsServiceOpenmrsService.onShutdown()public void shutdownAllTasks()
public Task scheduleTask(TaskDefinition taskDefinition) throws SchedulerException
scheduleTask in interface SchedulerServicetaskDefinition - the task to be scheduledTask, or null if there was a problem instantiating or
scheduling the taskSchedulerExceptionpublic void shutdownTask(TaskDefinition taskDefinition) throws SchedulerException
shutdownTask in interface SchedulerServicetaskDefinition - the task to be stoppedSchedulerExceptionSchedulerService.shutdownTask(TaskDefinition)public void rescheduleAllTasks()
throws SchedulerException
rescheduleAllTasks in interface SchedulerServiceSchedulerExceptionpublic Task rescheduleTask(TaskDefinition taskDefinition) throws SchedulerException
SchedulerServicerescheduleTask in interface SchedulerServicetaskDefinition - the TaskDefinition to rescheduleSchedulerExceptionSchedulerService.rescheduleTask(org.openmrs.scheduler.TaskDefinition)public void registerTask(TaskDefinition definition)
definition - task to registerpublic Collection<TaskDefinition> getScheduledTasks()
getScheduledTasks in interface SchedulerServicepublic Collection<TaskDefinition> getRegisteredTasks()
getRegisteredTasks in interface SchedulerServicepublic TaskDefinition getTask(Integer id)
getTask in interface SchedulerServiceid - the identifier of the taskpublic TaskDefinition getTaskByName(String name)
getTaskByName in interface SchedulerServicename - name of the taskpublic void saveTask(TaskDefinition task)
saveTask in interface SchedulerServicetask - the TaskDefinition to savepublic void deleteTask(Integer id)
deleteTask in interface SchedulerServiceid - the identifier of the taskpublic SortedMap<String,String> getSystemVariables()
getSystemVariables in interface SchedulerServicepublic OpenmrsMemento saveToMemento()
saveToMemento in interface SchedulerServicepublic void restoreFromMemento(OpenmrsMemento memento)
SchedulerServicerestoreFromMemento in interface SchedulerServicepublic String getStatus(Integer id)
SchedulerServicegetStatus in interface SchedulerServiceString status of the task with the given identifierTODO
internationalization of string status messagesCopyright © 2018 OpenMRS LLC.. All Rights Reserved.