-
- All Implemented Interfaces:
-
java.lang.Runnable
public abstract class PeriodicRunnable implements Runnable
Utility for creating a Runnable that needs to run multiple times.
<p>This class is internal and not for public use. Its APIs are unstable and can change at any time.
-
-
Constructor Summary
Constructors Constructor Description PeriodicRunnable()
-
Method Summary
Modifier and Type Method Description final Unitrun()abstract UnitonRun()Called only if a) The runnable has never run before, OR b) The minimum amount of time delay has passed after the last run. abstract BooleanshouldStopRunning()Should return FALSE when further runs are needed, TRUE if no need for this task to ever run again. abstract LongminimumDelayUntilNextRunInMillis()The minimum amount of time to wait between runs, it might take longer than what's defined here to run this task again depending on when the next batch of background work will get submitted. -
-
Method Detail
-
onRun
abstract Unit onRun()
Called only if a) The runnable has never run before, OR b) The minimum amount of time delay has passed after the last run.
-
shouldStopRunning
abstract Boolean shouldStopRunning()
Should return FALSE when further runs are needed, TRUE if no need for this task to ever run again.
-
minimumDelayUntilNextRunInMillis
abstract Long minimumDelayUntilNextRunInMillis()
The minimum amount of time to wait between runs, it might take longer than what's defined here to run this task again depending on when the next batch of background work will get submitted.
-
-
-
-