Interface ListeningScheduledExecutorService
-
- All Superinterfaces:
,
,
@GwtIncompatible public interface ListeningScheduledExecutorService extends , ListeningExecutorService
A that returnsListenableFuture
instances from itsExecutorService
methods. To create an instance from an existing , callMoreExecutors.listeningDecorator(ScheduledExecutorService)
.- Since:
- 10.0
- Author:
- Chris Povirk
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ListenableScheduledFuture<?>
command, long delay, unit)
Submits a one-shot task that becomes enabled after the given delay.default ListenableScheduledFuture<?>
command, delay)
Duration-based overload ofschedule(Runnable, long, TimeUnit)
.<V> ListenableScheduledFuture<V>
<V> callable, long delay, unit)
Submits a value-returning one-shot task that becomes enabled after the given delay.default <V> ListenableScheduledFuture<V>
<V> callable, delay)
Duration-based overload ofschedule(Callable, long, TimeUnit)
.ListenableScheduledFuture<?>
command, long initialDelay, long period, unit)
Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence afterinitialDelay
, theninitialDelay + period
, theninitialDelay + 2 * period
, and so on.default ListenableScheduledFuture<?>
command, initialDelay, period)
Duration-based overload ofscheduleAtFixedRate(Runnable, long, long, TimeUnit)
.ListenableScheduledFuture<?>
command, long initialDelay, long delay, unit)
Submits 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.default ListenableScheduledFuture<?>
command, initialDelay, delay)
Duration-based overload ofscheduleWithFixedDelay(Runnable, long, long, TimeUnit)
.
-
-
-
Method Detail
-
schedule
command, long delay, unit)
Description copied from interface:Submits a one-shot task that becomes enabled after the given delay.- Specified by:
in interface
- Parameters:
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameter- Returns:
- a ScheduledFuture representing pending completion of
the task and whose
get()
method will returnnull
upon completion - Since:
- 15.0 (previously returned ScheduledFuture)
-
schedule
default command, delay)
Duration-based overload ofschedule(Runnable, long, TimeUnit)
.- Since:
- 29.0
-
schedule
<V> <V> callable, long delay, unit)
Description copied from interface:Submits a value-returning one-shot task that becomes enabled after the given delay.- Specified by:
in interface
- Type Parameters:
V
- the type of the callable's result- Parameters:
callable
- the function to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameter- Returns:
- a ScheduledFuture that can be used to extract result or cancel
- Since:
- 15.0 (previously returned ScheduledFuture)
-
schedule
default <V> <V> callable, delay)
Duration-based overload ofschedule(Callable, long, TimeUnit)
.- Since:
- 29.0
-
scheduleAtFixedRate
command, long initialDelay, long period, unit)
Description copied from interface:Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence afterinitialDelay
, theninitialDelay + period
, theninitialDelay + 2 * period
, and so on.The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
- The task is via the returned future.
- The executor terminates, also resulting in task cancellation.
- An execution of the task throws an exception. In this case calling on the returned future will throw , holding the exception as its cause.
true
.If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
- Specified by:
in interface
- Parameters:
command
- the task to executeinitialDelay
- the time to delay first executionperiod
- the period between successive executionsunit
- the time unit of the initialDelay and period parameters- Returns:
- a ScheduledFuture representing pending completion of the series of repeated tasks. The future's method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.
- Since:
- 15.0 (previously returned ScheduledFuture)
-
scheduleAtFixedRate
default command, initialDelay, period)
Duration-based overload ofscheduleAtFixedRate(Runnable, long, long, TimeUnit)
.- Since:
- 29.0
-
scheduleWithFixedDelay
command, long initialDelay, long delay, unit)
Description copied from interface:Submits 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.The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
- The task is via the returned future.
- The executor terminates, also resulting in task cancellation.
- An execution of the task throws an exception. In this case calling on the returned future will throw , holding the exception as its cause.
true
.- Specified by:
in interface
- Parameters:
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 parameters- Returns:
- a ScheduledFuture representing pending completion of the series of repeated tasks. The future's method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.
- Since:
- 15.0 (previously returned ScheduledFuture)
-
scheduleWithFixedDelay
default command, initialDelay, delay)
Duration-based overload ofscheduleWithFixedDelay(Runnable, long, long, TimeUnit)
.- Since:
- 29.0
-
-