org.omus.core
Class TaskManager

java.lang.Object
  |
  +--org.omus.core.TaskManager

public abstract class TaskManager
extends java.lang.Object

A facility to schedule tasks for future execution in a background thread. Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals. Some of the methods of TaskManager simply delegate the specified TimerTask to the encapsulated Timer instance. Others require a Command object to be specified and are an extension to the functionality found in java.util.Timer.

You should avoid to create your own threads or Timer instances, it may prevent the correct shutdown of the Oregano Server.


Method Summary
 void cancel(Command com)
          Cancels regular execution of the specified Command.
 void executeDaily(Command com)
          Executes the specified Command every day at the time specified in the <statistics>-node in config.xml.
 void executeMonthly(Command com, int dayInMonth)
          Executes the specified Command each month on the specified day at the time specified in the <statistics>-node in config.xml.
 void executeNow(Command com)
          Delegates the execution of the specified Command to one of the worker threads in the Oregano Thread pool.
 void executeWeekly(Command com, int dayInWeek)
          Executes the specified Command once a week on the specified day at the time specified in the <statistics>-node in config.xml.
 void schedule(java.util.TimerTask task, java.util.Date time)
          Schedules the specified task for execution at the specified time.
 void schedule(java.util.TimerTask task, java.util.Date firstTime, long period)
          Schedules the specified task for repeated fixed-delay execution, beginning at the specified time.
 void schedule(java.util.TimerTask task, long delay)
          Schedules the specified task for execution after the specified delay.
 void schedule(java.util.TimerTask task, long delay, long period)
          Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.
 void scheduleAtFixedRate(java.util.TimerTask task, java.util.Date firstTime, long period)
          Schedules the specified task for repeated fixed-rate execution, beginning at the specified time.
 void scheduleAtFixedRate(java.util.TimerTask task, long delay, long period)
          Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

executeNow

public final void executeNow(Command com)
Delegates the execution of the specified Command to one of the worker threads in the Oregano Thread pool.

schedule

public final void schedule(java.util.TimerTask task,
                           long delay)
Schedules the specified task for execution after the specified delay.

schedule

public final void schedule(java.util.TimerTask task,
                           java.util.Date time)
Schedules the specified task for execution at the specified time.

schedule

public final void schedule(java.util.TimerTask task,
                           java.util.Date firstTime,
                           long period)
Schedules the specified task for repeated fixed-delay execution, beginning at the specified time. For details see the documentation for the corresponding method in java.util.Timer.

schedule

public final void schedule(java.util.TimerTask task,
                           long delay,
                           long period)
Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay. For details see the documentation for the corresponding method in java.util.Timer.

scheduleAtFixedRate

public final void scheduleAtFixedRate(java.util.TimerTask task,
                                      java.util.Date firstTime,
                                      long period)
Schedules the specified task for repeated fixed-rate execution, beginning at the specified time. For details see the documentation for the corresponding method in java.util.Timer.

scheduleAtFixedRate

public final void scheduleAtFixedRate(java.util.TimerTask task,
                                      long delay,
                                      long period)
Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay. For details see the documentation for the corresponding method in java.util.Timer.

executeDaily

public final void executeDaily(Command com)
Executes the specified Command every day at the time specified in the <statistics>-node in config.xml.

executeWeekly

public final void executeWeekly(Command com,
                                int dayInWeek)
Executes the specified Command once a week on the specified day at the time specified in the <statistics>-node in config.xml. Valid values for dayInWeek range from 1 (Sunday) to 7 (Saturday).

executeMonthly

public final void executeMonthly(Command com,
                                 int dayInMonth)
Executes the specified Command each month on the specified day at the time specified in the <statistics>-node in config.xml. Valid values for dayInMonth range from 1 to 31 - obviously.

cancel

public final void cancel(Command com)
Cancels regular execution of the specified Command.