public abstract class TimerTask extends Object implements Executable, Comparable
TimerQueue
. A similar class is present in java.util package of jdk version >= 1.3; for compatibility with jdk 1.2 we reimplemented it.
TimerQueue
Modifier | Constructor and Description |
---|---|
protected |
TimerTask()
Creates a TimerTask object that will be executed once.
|
protected |
TimerTask(long period)
Creates a TimerTask object that will be executed every
period
milliseconds. |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Cancels the next execution of this TimerTask (if any).
|
int |
compareTo(Object other)
A TimerTask is less than another if it will be scheduled before.
|
abstract void |
execute()
The task to be executed, to be implemented in subclasses.
|
protected long |
getPeriod() |
protected TimerTask()
protected TimerTask(long period)
period
milliseconds. period
- the execution period; if zero, will be executed only once.public boolean cancel()
public abstract void execute() throws Exception
execute
in interface Executable
Exception
public int compareTo(Object other)
compareTo
in interface Comparable
ClassCastException
- if other is not a TimerTask, according to the Comparable contractprotected long getPeriod()
Copyright © 2018 JBoss by Red Hat. All rights reserved.