com.caucho.resources
Class ScheduledTask

java.lang.Object
  extended by com.caucho.resources.ScheduledTask
All Implemented Interfaces:
EnvironmentListener, AlarmListener, java.util.EventListener

@Singleton
@Unbound
@Configurable
public class ScheduledTask
extends java.lang.Object
implements AlarmListener, EnvironmentListener

The cron resources starts application Work tasks at cron-specified intervals.


Nested Class Summary
static class ScheduledTask.MethodTask
           
 class ScheduledTask.ServletTask
           
 
Constructor Summary
ScheduledTask()
          Constructor.
 
Method Summary
 void add(java.lang.Runnable task)
           
 void environmentBind(EnvironmentClassLoader loader)
          Handles the case where the environment is binding injection targets
 void environmentConfigure(EnvironmentClassLoader loader)
          Handles the case where the environment is configuring and registering beans
 void environmentStart(EnvironmentClassLoader loader)
          Handles the case where the environment is starting (after init).
 void environmentStop(EnvironmentClassLoader loader)
          Handles the case where the environment is stopping (after init).
 java.lang.Runnable getTask()
           
 void handleAlarm(Alarm alarm)
          The runnable.
 void init()
          Initialization.
 void setCron(java.lang.String cron)
          Sets the cron interval.
 void setDelay(Period delay)
          Sets the delay
 void setMethod(MethodExpression method)
          Sets the method expression as a task
 void setPeriod(Period period)
          Sets the period
 void setTask(java.lang.Runnable task)
          Sets the task.
 void setUrl(java.lang.String url)
          Sets the url expression as a task
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScheduledTask

public ScheduledTask()
Constructor.

Method Detail

setDelay

@Configurable
public void setDelay(Period delay)
Sets the delay


setPeriod

@Configurable
public void setPeriod(Period period)
Sets the period


setCron

@Configurable
public void setCron(java.lang.String cron)
Sets the cron interval.


setMethod

@Configurable
public void setMethod(MethodExpression method)
Sets the method expression as a task


setUrl

@Configurable
public void setUrl(java.lang.String url)
Sets the url expression as a task


setTask

@Configurable
public void setTask(java.lang.Runnable task)
Sets the task.


getTask

public java.lang.Runnable getTask()

add

@Configurable
public void add(java.lang.Runnable task)

init

@PostConstruct
public void init()
          throws ConfigException
Initialization.

Throws:
ConfigException

handleAlarm

public void handleAlarm(Alarm alarm)
The runnable.

Specified by:
handleAlarm in interface AlarmListener

environmentConfigure

public void environmentConfigure(EnvironmentClassLoader loader)
                          throws ConfigException
Description copied from interface: EnvironmentListener
Handles the case where the environment is configuring and registering beans

Specified by:
environmentConfigure in interface EnvironmentListener
Throws:
ConfigException

environmentBind

public void environmentBind(EnvironmentClassLoader loader)
                     throws ConfigException
Description copied from interface: EnvironmentListener
Handles the case where the environment is binding injection targets

Specified by:
environmentBind in interface EnvironmentListener
Throws:
ConfigException

environmentStart

public void environmentStart(EnvironmentClassLoader loader)
Description copied from interface: EnvironmentListener
Handles the case where the environment is starting (after init).

Specified by:
environmentStart in interface EnvironmentListener

environmentStop

public void environmentStop(EnvironmentClassLoader loader)
Description copied from interface: EnvironmentListener
Handles the case where the environment is stopping (after init).

Specified by:
environmentStop in interface EnvironmentListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object