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 singleRunnabletask.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetPeriodicTask(Runnable task)Specify the task that this PeriodicRunner should run periodically.voidstart()Start calling the specified Runnable task periodically.voidstop()Stop the Runnable task from executing in the future.
-
-
-
Method Detail
-
setPeriodicTask
public void setPeriodicTask(Runnable task)
Description copied from interface:PeriodicRunnerSpecify 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:
setPeriodicTaskin interfacePeriodicRunner- Parameters:
task- The task to run periodically.
-
start
public void start()
Description copied from interface:PeriodicRunnerStart calling the specified Runnable task periodically.- Specified by:
startin 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:
stopin interfacePeriodicRunner
-
-