periodic+subsequent+commence+enc

2018-02-28  本文已影响9人  海德堡绝尘

API来源:
public interface ScheduledExecutorService extends ExecutorService:
ScheduledExecutorService#scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit);

public ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
                                                  long initialDelay,
                                                  long period,
                                                  TimeUnit unit);

Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on. If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the executor. If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
创建并执行一个定期动作,在给定的初始延迟之后首先变为启用,然后在给定的时间段内启用; 即执行将在initialDelay之后开始,然后是initialDelay +周期,然后是initialDelay + 2 *周期,依此类推。 如果任务的任何执行遇到异常,则后续执行被禁止。 否则,任务将仅通过取消或终止执行者而终止。 如果此任务的任何执行时间超过其时间段,则后续执行可能会迟到,但不会同时执行。

上一篇 下一篇

猜你喜欢

热点阅读