com.caucho.config.timer
Class TimerTask

java.lang.Object
  extended by com.caucho.config.timer.TimerTask
All Implemented Interfaces:
AlarmListener, java.util.EventListener

public class TimerTask
extends java.lang.Object
implements AlarmListener

Scheduled task.


Constructor Summary
TimerTask(TimeoutInvoker invoker, java.lang.Runnable task, CronExpression cronExpression, Trigger trigger, java.io.Serializable data)
          Constructs a new scheduled task.
 
Method Summary
 void cancel()
          Cancels the scheduled task.
 boolean equals(java.lang.Object object)
          Checks for equality with another object.
 CronExpression getCronExpression()
          Gets the cron expression used to create the schedule.
 java.io.Serializable getData()
          Gets the data to be passed to the invocation target.
 long getNextAlarmTime()
          Get the next time, in milliseconds, when the alarm will be triggered for the scheduled task.
 ScheduledTaskStatus getStatus()
          Gets the current status of this task.
 long getTaskId()
          Gets task ID.
 void handleAlarm(Alarm alarm)
          Handles alarm.
 int hashCode()
          Gets the hash code for this object.
 void invoke(Timer timer)
           
 void start()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimerTask

public TimerTask(TimeoutInvoker invoker,
                 java.lang.Runnable task,
                 CronExpression cronExpression,
                 Trigger trigger,
                 java.io.Serializable data)
Constructs a new scheduled task.

Parameters:
targetBean - The target bean to be invoked by the task.
targetMethod - The target method to be invoked by the task.
task - The task to be invoked.
cronExpression - The cron expression used to create the schedule, if any.
trigger - The trigger for the schedule.
start - The start date, in milliseconds for the scheduled task. -1 used to indicate no start date.
end - The end date, in milliseconds for the scheduled task. -1 used to indicate no end date.
data - The data to be passed to the invocation target.
Method Detail

start

public void start()

getTaskId

public long getTaskId()
Gets task ID.

Returns:
Task ID.

getCronExpression

public CronExpression getCronExpression()
Gets the cron expression used to create the schedule.

Returns:
Cron expression used to create the schedule, if one was used.

getData

public java.io.Serializable getData()
Gets the data to be passed to the invocation target.

Returns:
Data to be passed to the invocation target.

getNextAlarmTime

public long getNextAlarmTime()
Get the next time, in milliseconds, when the alarm will be triggered for the scheduled task.

Returns:
The next time, in milliseconds, when the alarm will be triggered for the scheduled task.

cancel

public void cancel()
Cancels the scheduled task. Any currently running tasks will not be terminated, but no more triggers will be fired for this task.


getStatus

public ScheduledTaskStatus getStatus()
Gets the current status of this task.

Returns:
Status of the scheduled task.

invoke

public void invoke(Timer timer)

handleAlarm

public void handleAlarm(Alarm alarm)
Handles alarm.

Specified by:
handleAlarm in interface AlarmListener
Parameters:
alarm - Alarm to handle.

hashCode

public int hashCode()
Gets the hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code for this object.

equals

public boolean equals(java.lang.Object object)
Checks for equality with another object.

Overrides:
equals in class java.lang.Object
Parameters:
object - The object to compare with.
Returns:
True if the objects are not equal, false otherwise.

toString

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