Java & Executor & ScheduledFuture & 总结

前言


 相关系列

 涉及内容

概述


 简介

在这里插入图片描述

    ScheduledFuture @ 调度未来接口是代理任务功能/延迟性的概念封装。作为Future @ 未来接口的子接口,调度未来接口继承了未来接口对代理任务功能性的概念封装,即继承了未来接口追踪/干预/获取代理任务执行状态/过程/结果的能力,并在此基础上为代理任务进行了延迟性概念封装。所谓延迟性概念封装即是令代理任务具备延迟执行的可能,因此调度未来接口实际上还是Delayed @ 延迟接口的子接口,目的是通过getDelay(TimeUnit unit)方法给延迟机制提供数据依据。延迟性概念封装使得代理任务具备了被调度(定时/重复)执行的可能,即通过延迟达到令代理任务定时执行的效果。

/**
 * A delayed result-bearing action that can be cancelled. Usually a scheduled future is the result of scheduling a task
 * with a {@link ScheduledExecutorService}.
 * 一个可以取消的延迟的产生结果的行为。通常一个计划未来被安排为计划执行器服务任务的结果。
 *
 * @param <V> The result type returned by this Future 当前未来返回的结果类型
 * @author Doug Lea
 * @since 1.5
 */
public interface ScheduledFuture<V> extends Delayed, Future<V> {
    
    
}

猜你喜欢

转载自blog.csdn.net/qq_39288456/article/details/143431198