Methods Summary |
---|
public boolean | cancel()Cancels the {@code TimerTask} and removes it from the {@code Timer}'s queue. Generally, it
returns {@code false} if the call did not prevent a {@code TimerTask} from running at
least once. Subsequent calls have no effect.
synchronized (lock) {
boolean willRun = !cancelled && when > 0;
cancelled = true;
return willRun;
}
|
long | getWhen()
/*
* Method called from the Timer for synchronized getting of when field.
*/
synchronized (lock) {
return when;
}
|
boolean | isScheduled()
synchronized (lock) {
return when > 0 || scheduledTime > 0;
}
|
public abstract void | run()The task to run should be specified in the implementation of the {@code run()}
method.
|
public long | scheduledExecutionTime()Returns the scheduled execution time. If the task execution is in
progress it returns the execution time of the ongoing task. Tasks which
have not yet run return an undefined value.
synchronized (lock) {
return scheduledTime;
}
|
void | setScheduledTime(long time)
synchronized (lock) {
scheduledTime = time;
}
|