Class SimplePeriodicRunner
- java.lang.Object
-
- com.pervasivecode.utils.time.impl.SimplePeriodicRunner
-
- All Implemented Interfaces:
PeriodicRunner
public class SimplePeriodicRunner extends Object implements PeriodicRunner
A periodic runner of a singleRunnable
task.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setPeriodicTask(Runnable task)
Specify the task that this PeriodicRunner should run periodically.void
start()
Start calling the specified Runnable task periodically.void
stop()
Stop the Runnable task from executing in the future.
-
-
-
Method Detail
-
setPeriodicTask
public void setPeriodicTask(Runnable task)
Description copied from interface:PeriodicRunner
Specify the task that this PeriodicRunner should run periodically. The specified task will not be run until after thePeriodicRunner.start()
method has been called.- Specified by:
setPeriodicTask
in interfacePeriodicRunner
- Parameters:
task
- The task to run periodically.
-
start
public void start()
Description copied from interface:PeriodicRunner
Start calling the specified Runnable task periodically.- Specified by:
start
in interfacePeriodicRunner
-
stop
public void stop()
Stop the Runnable task from executing in the future. Note that this will not interrupt the Runnable task if it is currently executing; it will finish the current execution normally.- Specified by:
stop
in interfacePeriodicRunner
-
-