org.sape.carbon.services.scheduler
Class AbstractTask

java.lang.Object
  |
  +--org.sape.carbon.services.scheduler.AbstractTask
Direct Known Subclasses:
FixedDelayTask, FixedRateTask

public abstract class AbstractTask
extends Object

Base class for tasks run by the SchedulerService. The main purpose of this class is to implement a java.util.TimerTask that calls the runScheduledTask of the Schedulable interface on the configured component. Subclasses implement their own scheduling functionality by implementing the schedule method, calling one of the schedule methods on the java.util.Timer class.

Since:
carbon 1.0
Version:
$Revision: 1.15 $($Author: dvoet $ / $Date: 2003/12/08 15:59:15 $)
Author:
Douglas Voet, June 2002
See Also:
Timer, Copyright 2002 Sapient

Nested Class Summary
private static class AbstractTask.InternalTask
          Class that extends java.util.TimerTask.
private static class AbstractTask.TaskQueuer
           
 
Field Summary
private static org.apache.commons.logging.Log log
          Provides a handle to Apache-commons logger
private  BaseTaskConfiguration taskConfiguration
           
private  ThreadPool threadPool
           
 
Constructor Summary
protected AbstractTask(BaseTaskConfiguration taskConfiguration, ThreadPool threadPool)
          Loads and validates the component called from this task.
 
Method Summary
protected  TimerTask getTask()
          Method used to get the java.util.TimerTask reprentation of this Task.
abstract  void schedule(Timer timer)
          Method called to schedule this task on the given Timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
Provides a handle to Apache-commons logger


taskConfiguration

private BaseTaskConfiguration taskConfiguration

threadPool

private ThreadPool threadPool
Constructor Detail

AbstractTask

protected AbstractTask(BaseTaskConfiguration taskConfiguration,
                       ThreadPool threadPool)
Loads and validates the component called from this task.

Parameters:
taskConfiguration - the configuration of the Schedulable component called from this task.
Method Detail

schedule

public abstract void schedule(Timer timer)
Method called to schedule this task on the given Timer. Implementations are responsible for determining when to schedule this task, its repeat period and how it is scheduled (fixed rate or delay). To this end, one of the schedule mehtods on timer should be called.

Parameters:
timer - Timer on which this task should be scheduled

getTask

protected TimerTask getTask()
Method used to get the java.util.TimerTask reprentation of this Task. The intended use is within the schedule abstract method.

Returns:
TimerTask Task to be scheduled within the schedule method.


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.