public static void startup(java.util.Properties p)
Start the scheduler given the following start up properties.
p - properties used to start the service
public static void shutdown()
Shutdown the scheduler service that is statically associated with the Context class.
public static void sendSchedulerError(java.lang.Throwable throwable)
Sends an email with system information and the given exception
public static java.lang.String getExceptionAsString(java.lang.Throwable t)
String representation of the given exception
public static java.util.Date getNextExecution(TaskDefinition taskDefinition)
Gets the next execution time based on the initial start time (possibly years ago, depending
on when the task was configured in OpenMRS) and the repeat interval of execution. We need to
calculate the "next execution time" because the scheduled time is most likely in the past and
the JDK timer will run the task X number of times from the start time until now in order to
catch up. The assumption is that this is not the desired behavior -- we just want to execute
the task on its next execution time. For instance, say we had a scheduled task that ran every
24 hours at midnight. In the database, the task would likely have a past start date (i.e.
04/01/2006 12:00am). If we scheduled the task using the JDK Timer
scheduleAtFixedRate(TimerTask task, Date startDate, int interval) method and passed in the
start date above, the JDK Timer would execute this task once for every day between the start
date and today, which would lead to hundreds of unnecessary (and likely expensive)
taskDefinition - the task definition to be executed
the next "future" execution time for the given task