@GwtIncompatible public interface ListeningScheduledExecutorService extends ScheduledExecutorService, ListeningExecutorService
ScheduledExecutorService
that returns ListenableFuture
instances from its
ExecutorService
methods. To create an instance from an existing ScheduledExecutorService
, call MoreExecutors.listeningDecorator(ScheduledExecutorService)
.Modifier and Type | Method and Description |
---|---|
<V> ListenableScheduledFuture<V> |
schedule(Callable<V> callable,
long delay,
TimeUnit unit)
Creates and executes a ScheduledFuture that becomes enabled after the
given delay.
|
ListenableScheduledFuture<?> |
schedule(Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled
after the given delay.
|
ListenableScheduledFuture<?> |
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. |
ListenableScheduledFuture<?> |
scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first
after the given initial delay, and subsequently with the
given delay between the termination of one execution and the
commencement of the next.
|
invokeAll, invokeAll, submit, submit, submit
awaitTermination, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
ListenableScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
java.util.concurrent.ScheduledExecutorService
schedule
in interface ScheduledExecutorService
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterget()
method will return
null
upon completion<V> ListenableScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
java.util.concurrent.ScheduledExecutorService
schedule
in interface ScheduledExecutorService
V
- the type of the callable's resultcallable
- the function to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterListenableScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
java.util.concurrent.ScheduledExecutorService
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.scheduleAtFixedRate
in interface ScheduledExecutorService
command
- the task to executeinitialDelay
- the time to delay first executionperiod
- the period between successive executionsunit
- the time unit of the initialDelay and period parametersget()
method will throw an
exception upon cancellationListenableScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
java.util.concurrent.ScheduledExecutorService
scheduleWithFixedDelay
in interface ScheduledExecutorService
command
- the task to executeinitialDelay
- the time to delay first executiondelay
- the delay between the termination of one
execution and the commencement of the nextunit
- the time unit of the initialDelay and delay parametersget()
method will throw an
exception upon cancellationCopyright © 2010–2019. All rights reserved.