JobScheduler.java 文件源码

java
阅读 52 收藏 0 点赞 0 评论 0

项目:JobSchedulerCompat 作者:
/**
 * Notify the scheduler that a job finished executing.
 *
 * Handle scheduler changes by cancelling it in the old scheduler and scheduling it in the new scheduler.
 */
@RestrictTo(RestrictTo.Scope.LIBRARY)
public void onJobCompleted(int jobId, boolean needsReschedule) {
    synchronized (JobStore.LOCK) {
        JobStatus jobStatus = jobStore.getJob(jobId);
        if (jobStatus != null) {
            jobStore.remove(jobId);
            if (needsReschedule) {
                jobStore.add(getRescheduleJobForFailure(jobStatus));
            } else if (jobStatus.isPeriodic()) {
                jobStore.add(getRescheduleJobForPeriodic(jobStatus));
            }
            getSchedulerForTag(context, jobStatus.getSchedulerTag()).onJobCompleted(jobId, needsReschedule);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号