ScheduledThreadPoolExecutor.scheduleAtFixedRate

Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence after {@code initialDelay}, then {@code initialDelay + period}, then {@code initialDelay + 2 * period}, and so on.

<p>The sequence of task executions continues indefinitely until one of the following exceptional completions occur: <ul> <li>The task is {@linkplain Future#cancel explicitly cancelled} via the returned future. <li>Method {@link #shutdown} is called and the {@linkplain #getContinueExistingPeriodicTasksAfterShutdownPolicy policy on whether to continue after shutdown} is not set true, or method {@link #shutdownNow} is called; also resulting in task cancellation. <li>An execution of the task throws an exception. In this case calling {@link Future#get() get} on the returned future will throw {@link ExecutionException}, holding the exception as its cause. </ul> Subsequent executions are suppressed. Subsequent calls to {@link Future#isDone isDone()} on the returned future will return {@code true}.

<p>If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.

@throws RejectedExecutionException {@inheritDoc} @throws NullPointerException {@inheritDoc} @throws IllegalArgumentException {@inheritDoc}

class ScheduledThreadPoolExecutor
scheduleAtFixedRate
(
Runnable command
,
Duration initialDelay
,
Duration period
)

Meta