Package 

Class PeriodicRunnable

  • 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.
    • Method Summary

      Modifier and Type Method Description
      final Unit run()
      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.
      abstract Boolean shouldStopRunning() Should return FALSE when further runs are needed, TRUE if no need for this task to ever run again.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PeriodicRunnable

        PeriodicRunnable()
    • 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.