-
public class JobSchedulerManages jobs so that only one can be executed at a time and no more often than once in
mMinimumJobIntervalMsmilliseconds.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceJobScheduler.JobRunnable
-
Constructor Summary
Constructors Constructor Description JobScheduler(Executor executor, JobScheduler.JobRunnable jobRunnable, int minimumJobIntervalMs)
-
Method Summary
Modifier and Type Method Description voidclearJob()Clears the currently set job. booleanupdateJob(@Nullable() EncodedImage encodedImage, int status)Updates the job. booleanscheduleJob()Schedules the currently set job (if any). synchronized longgetQueuedTime()Gets the queued time in milliseconds for the currently running job. -
-
Constructor Detail
-
JobScheduler
JobScheduler(Executor executor, JobScheduler.JobRunnable jobRunnable, int minimumJobIntervalMs)
-
-
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
minimumJobIntervalMsmillisecondssince 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.
-
-
-
-