public abstract class TimerTask
extends java.lang.Object
implements java.lang.Runnable
Modifier | Constructor and Description |
---|---|
protected |
TimerTask()
Creates a new timer task.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Cancels this timer task.
|
abstract void |
run()
The action to be performed by this timer task.
|
long |
scheduledExecutionTime()
Returns the scheduled execution time of the most recent actual execution of this task.
|
void |
uncaughtException(Timer timer,
java.lang.Throwable e)
Method invoked when this
TimerTask terminates due to the given uncaught exception. |
public abstract void run()
run
in interface java.lang.Runnable
Thread.run()
public boolean cancel()
true
if this task is scheduled for one-time execution and has not yet
run, or this task is scheduled for repeated execution. Returns false
if
the task was scheduled for one-time execution and has already run, or if the task was
never scheduled, or if the task was already canceled (Loosely speaking, this method
returns true
if it prevents one or more scheduled executions from taking
place.)public long scheduledExecutionTime()
Date.getTime()
public void uncaughtException(Timer timer, java.lang.Throwable e)
Method invoked when this TimerTask
terminates due to the given uncaught exception.
Default behavior of this method is to cancel the task and to invoke Throwable.printStackTrace()
method
on the given exception.
Any exception thrown by this method will be ignored.