Package 

Class JobScheduler


  • 
    public class JobScheduler
    
                        

    Manages jobs so that only one can be executed at a time and no more often than once in mMinimumJobIntervalMs milliseconds.

    • Method Summary

      Modifier and Type Method Description
      void clearJob() Clears the currently set job.
      boolean updateJob(@Nullable() EncodedImage encodedImage, int status) Updates the job.
      boolean scheduleJob() Schedules the currently set job (if any).
      synchronized long getQueuedTime() Gets the queued time in milliseconds for the currently running job.
      • Methods inherited from class java.lang.Object

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

      • clearJob

         void clearJob()

        Clears the currently set job.

        In case the currently set job has been scheduled but not started yet, the job won't beexecuted.

      • updateJob

         boolean updateJob(@Nullable() EncodedImage encodedImage, int status)

        Updates the job.

        This just updates the job, but it doesn't schedule it. In order to be executed, the job hasto be scheduled after being set. In case there was a previous job scheduled that has not yetstarted, this new job will be executed instead.

      • scheduleJob

         boolean scheduleJob()

        Schedules the currently set job (if any).

        This method can be called multiple times. It is guaranteed that each job set will beexecuted no more than once. It is guaranteed that the last job set will be executed, unless thejob was cleared first.

        The job will be scheduled no sooner than minimumJobIntervalMs millisecondssince the last job started.

      • getQueuedTime

         synchronized long getQueuedTime()

        Gets the queued time in milliseconds for the currently running job.

        The result is only valid if called from run.