java.lang.Object
edu.emory.mathcs.util.concurrent.AlarmClock
- public class AlarmClock
- extends java.lang.Object
This class provide some value-added over java.util.Timer: that is,
it enables rescheduling of previously scheduled tasks.
- Version:
- 1.0
|
Method Summary |
boolean |
cancel()
Cancel the scheduled task. |
boolean |
setAlarmDelay(long delay)
Reschedule previously scheduled task. |
void |
setAlarmDelayIfSooner(long delay)
Reschedule previously scheduled task unless it would postpone it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
engine
final java.util.Timer engine
task
final java.lang.Runnable task
timerTask
java.util.TimerTask timerTask
AlarmClock
public AlarmClock(java.util.Timer engine,
java.lang.Runnable task)
setAlarmDelayIfSooner
public void setAlarmDelayIfSooner(long delay)
- Reschedule previously scheduled task unless it would postpone it.
In other words, if the requested delay is longer than the time remaining
until the previously scheduled execution, the request is ignored.
setAlarmDelay
public boolean setAlarmDelay(long delay)
- Reschedule previously scheduled task.
cancel
public boolean cancel()
- Cancel the scheduled task.