Package jmri.jmrit.logixng.util
Class ProtectedTimerTask
java.lang.Object
java.util.TimerTask
jmri.jmrit.logixng.util.ProtectedTimerTask
- All Implemented Interfaces:
Runnable
A timer task that can be stopped, and there the stop method waits until the
task is finished.
Note that this class does [u]not[/u] work for repeating timers. The class can be used for tasks that are scheduled over and over again, but only works for one shoot timer.
In other words, the class works for TimerUtil.schedule(@Nonnull TimerTask task, long delay) but not for TimerUtil.schedule(@Nonnull TimerTask task, long delay, long period). This is due to how the method TimerTask.cancel() works.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Constructor Details
-
ProtectedTimerTask
public ProtectedTimerTask()
-
-
Method Details
-
execute
-
run
-
stopTimer
Stop the timer. This method will not return until the timer task is cancelled and stopped. This code ensures that we don't return from this method until the timer task is cancelled and that it's not running any more.
-