Build 1.0_r1(from source)

java.util
Class TimerTask

java.lang.Object
  extended by java.util.TimerTask
All Implemented Interfaces:
Runnable

public abstract class TimerTask
extends Object
implements Runnable

The TimerTask class is represents a task to run at specified time. The task may be run once or repeatedly.

See Also:
Timer, Object.wait(long)

Field Summary
(package private)  boolean cancelled
           
(package private)  boolean fixedRate
           
(package private)  Object lock
           
(package private)  long period
           
(package private)  long when
           
 
Constructor Summary
protected TimerTask()
           
 
Method Summary
 boolean cancel()
          Cancels the Task and removes it from the Timer's queue.
(package private)  long getWhen()
           
(package private)  boolean isScheduled()
           
abstract  void run()
          The task to run should be specified in the implementation of the run() method.
 long scheduledExecutionTime()
          Returns the scheduled execution time.
(package private)  void setScheduledTime(long time)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

final Object lock

cancelled

boolean cancelled

when

long when

period

long period

fixedRate

boolean fixedRate
Constructor Detail

TimerTask

protected TimerTask()
Method Detail

getWhen

long getWhen()

setScheduledTime

void setScheduledTime(long time)

isScheduled

boolean isScheduled()

cancel

public boolean cancel()
Cancels the Task and removes it from the Timer's queue. Generally, it returns false if the call did not prevent a TimerTask from running at least once. Subsequent calls have no effect.

Returns:
true if the call prevented a scheduled execution from taking place, false otherwise.

scheduledExecutionTime

public long scheduledExecutionTime()
Returns the scheduled execution time. If the task execution is in progress returns the execution time of ongoing task. Tasks which have not yet run return an undefined value.

Returns:
the most recent execution time.

run

public abstract void run()
The task to run should be specified in the implementation of the run() method.

Specified by:
run in interface Runnable

Build 1.0_r1(from source)

Please submit a feedback, bug or feature