Deprecated
as a consequence of AsyncListenableTaskExecutor being deprecated. See corresponding docs for further information.
TaskScheduler interface, wrapping
a native java.util.concurrent.ScheduledThreadPoolExecutor and providing
all applicable configuration options for it.
setPoolSize, setRemoveOnCancelPolicy, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setThreadFactory, setErrorHandler
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private Clock | |
| private volatile boolean | |
| private volatile ErrorHandler | |
| private volatile boolean | |
| private final Map | |
| private static final TimeUnit | |
| private volatile int | |
| private volatile boolean | |
| private ScheduledExecutorService |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | cancelRemainingTask(Runnable
the task to cancel (typically a task)RunnableFuture)Overrides org. ExecutorService#shutdownNow().
|
| protected ScheduledExecutorService | Returns: a new ScheduledExecutorService instancethe specified pool size poolSize, ThreadFactory the ThreadFactory to use threadFactory, RejectedExecutionHandler the RejectedExecutionHandler to use rejectedExecutionHandler)Create a new |
| private Runnable | |
| public void | execute(Runnable
the task)Runnable to execute (never null)Implements org. task.
|
| private void | executeAndTrack(ExecutorService executor, ListenableFutureTask<?> listenableFuture)
Deprecated
as a consequence of
ListenableFutureTask being deprecated.
|
| public int | |
| public Clock | getClock()
Overrides default org. |
| public int | |
| public ScheduledExecutorService | Returns: the underlying ScheduledExecutorService (nevernull)Return the underlying ScheduledExecutorService for native access. |
| public ScheduledThreadPoolExecutor | Returns: the underlying ScheduledExecutorService (nevernull)Return the underlying ScheduledThreadPoolExecutor, if available. |
| protected ExecutorService | initializeExecutor(ThreadFactory
the ThreadFactory to use threadFactory, RejectedExecutionHandler the RejectedExecutionHandler to use rejectedExecutionHandler)Implements abstract org. java. instance.
|
| public boolean | isRemoveOnCancelPolicy()
Deprecated
as of 5.3.9, in favor of direct
Return the current setting for the remove-on-cancel mode.
getScheduledThreadPoolExecutor() access
|
| public ScheduledFuture | schedule(Runnable
the Runnable to execute whenever the trigger fires task, Trigger an implementation of the trigger)Trigger interface,
e.g. a org. object
wrapping a cron expressionImplements org. Runnable, invoking it whenever the trigger
indicates a next execution time.
|
| public ScheduledFuture | schedule(Runnable
the Runnable to execute whenever the trigger fires task, Instant the desired execution time for the task
(if this is in the past, the task will be executed immediately, i.e. as soon as possible) startTime)Implements org. Runnable, invoking it at the specified execution time.
|
| public ScheduledFuture | scheduleAtFixedRate(Runnable
the Runnable to execute whenever the trigger fires task, Instant the desired first execution time for the task
(if this is in the past, the task will be executed immediately, i.e. as soon as possible) startTime, Duration the interval between successive executions of the task period)Implements org. Runnable, invoking it at the specified execution time
and subsequently with the given period.
|
| public ScheduledFuture | scheduleAtFixedRate(Runnable
the Runnable to execute whenever the trigger fires task, Duration the interval between successive executions of the task period)Implements org. Runnable, starting as soon as possible and
invoking it with the given period.
|
| public ScheduledFuture | scheduleWithFixedDelay(Runnable
the Runnable to execute whenever the trigger fires task, Instant the desired first execution time for the task
(if this is in the past, the task will be executed immediately, i.e. as soon as possible) startTime, Duration the delay between the completion of one execution and the start of the next delay)Implements org. Runnable, invoking it at the specified execution time
and subsequently with the given delay between the completion of one execution
and the start of the next.
|
| public ScheduledFuture | scheduleWithFixedDelay(Runnable
the Runnable to execute whenever the trigger fires task, Duration the delay between the completion of one execution and the start of the next delay)Implements org. Runnable, starting as soon as possible and invoking it with
the given delay between the completion of one execution and the start of the next.
|
| public void | |
| public void | setContinueExistingPeriodicTasksAfterShutdownPolicy(boolean flag)
Set whether to continue existing periodic tasks even when this executor has been shutdown. |
| public void | |
| public void | setExecuteExistingDelayedTasksAfterShutdownPolicy(boolean flag)
Set whether to execute existing delayed tasks even when this executor has been shutdown. |
| public void | |
| public void | |
| public Future | submit(Runnable
the task)Runnable to execute (never null)Overrides default org. |
| public <T> Future | submit(Callable<T>
the task)Callable to execute (never null)Overrides default org. |
| public ListenableFuture | submitListenable(Runnable
the task)Runnable to execute (never null)Implements org.
Deprecated
as a consequence of
Submit a ListenableFuture being deprecated.
Runnable task for execution, receiving a ListenableFuture
representing that task.
|
| public <T> ListenableFuture | submitListenable(Callable<T>
the task)Callable to execute (never null)Implements org.
Deprecated
as a consequence of
Submit a ListenableFuture being deprecated.
Callable task for execution, receiving a ListenableFuture
representing that task.
|
| clock | back to summary |
|---|---|
| private Clock clock | |
| continueExistingPeriodicTasksAfterShutdownPolicy | back to summary |
|---|---|
| private volatile boolean continueExistingPeriodicTasksAfterShutdownPolicy | |
| errorHandler | back to summary |
|---|---|
| private volatile ErrorHandler errorHandler
| |
| executeExistingDelayedTasksAfterShutdownPolicy | back to summary |
|---|---|
| private volatile boolean executeExistingDelayedTasksAfterShutdownPolicy | |
| listenableFutureMap | back to summary |
|---|---|
| private final Map<Object, ListenableFuture<?>> listenableFutureMap | |
| NANO | back to summary |
|---|---|
| private static final TimeUnit NANO | |
| poolSize | back to summary |
|---|---|
| private volatile int poolSize | |
| removeOnCancelPolicy | back to summary |
|---|---|
| private volatile boolean removeOnCancelPolicy | |
| scheduledExecutor | back to summary |
|---|---|
| private ScheduledExecutorService scheduledExecutor
| |
| ThreadPoolTaskScheduler | back to summary |
|---|---|
| public ThreadPoolTaskScheduler() | |
| cancelRemainingTask | back to summary |
|---|---|
| protected void cancelRemainingTask(Runnable task) Overrides org. Doc from org. Cancel the given remaining task which never commenced execution,
as returned from
| |
| createExecutor | back to summary |
|---|---|
| protected ScheduledExecutorService createExecutor(int poolSize, ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) Create a new The default implementation creates a
| |
| errorHandlingTask | back to summary |
|---|---|
| private Runnable errorHandlingTask(Runnable task, boolean isRepeatingTask) | |
| execute | back to summary |
|---|---|
| public void execute(Runnable task) Implements org. Doc from org. Execute the given The call might return immediately if the implementation uses an asynchronous execution strategy, or might block in the case of synchronous execution. | |
| executeAndTrack | back to summary |
|---|---|
| private void executeAndTrack(ExecutorService executor, ListenableFutureTask<?> listenableFuture)
Deprecated as a consequence of | |
| getActiveCount | back to summary |
|---|---|
| public int getActiveCount() Return the number of currently active threads. Requires an underlying | |
| getClock | back to summary |
|---|---|
| public Clock getClock() Overrides default org. Doc from org. Return the clock to use for scheduling purposes.
| |
| getPoolSize | back to summary |
|---|---|
| public int getPoolSize() Return the current pool size. Requires an underlying | |
| getScheduledExecutor | back to summary |
|---|---|
| public ScheduledExecutorService getScheduledExecutor() throws IllegalStateException Return the underlying ScheduledExecutorService for native access.
| |
| getScheduledThreadPoolExecutor | back to summary |
|---|---|
| public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor() throws IllegalStateException Return the underlying ScheduledThreadPoolExecutor, if available.
| |
| initializeExecutor | back to summary |
|---|---|
| protected ExecutorService initializeExecutor(ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) Implements abstract org. Doc from org. Create the target
| |
| isRemoveOnCancelPolicy | back to summary |
|---|---|
| public boolean isRemoveOnCancelPolicy()
Deprecated as of 5.3.9, in favor of direct
Return the current setting for the remove-on-cancel mode. Requires an underlying
| |
| schedule | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| schedule | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| scheduleAtFixedRate | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| scheduleAtFixedRate | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| scheduleWithFixedDelay | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| scheduleWithFixedDelay | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| setClock | back to summary |
|---|---|
| public void setClock(Clock clock) Set the clock to use for scheduling purposes. The default clock is the system clock for the default time zone.
| |
| setContinueExistingPeriodicTasksAfterShutdownPolicy | back to summary |
|---|---|
| public void setContinueExistingPeriodicTasksAfterShutdownPolicy(boolean flag) Set whether to continue existing periodic tasks even when this executor has been shutdown. Default is This setting can be modified at runtime, for example through JMX.
| |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorHandler errorHandler) Set a custom | |
| setExecuteExistingDelayedTasksAfterShutdownPolicy | back to summary |
|---|---|
| public void setExecuteExistingDelayedTasksAfterShutdownPolicy(boolean flag) Set whether to execute existing delayed tasks even when this executor has been shutdown. Default is This setting can be modified at runtime, for example through JMX.
| |
| setPoolSize | back to summary |
|---|---|
| public void setPoolSize(int poolSize) Set the ScheduledExecutorService's pool size. Default is 1. This setting can be modified at runtime, for example through JMX. | |
| setRemoveOnCancelPolicy | back to summary |
|---|---|
| public void setRemoveOnCancelPolicy(boolean flag) Set the remove-on-cancel mode on Default is This setting can be modified at runtime, for example through JMX. | |
| submit | back to summary |
|---|---|
| public Future Overrides default org. Doc from org. Submit a Runnable task for execution, receiving a Future representing that task.
The Future will return a As of 6.1, this method comes with a default implementation that delegates
to | |
| submit | back to summary |
|---|---|
| public <T> Future Overrides default org. Doc from org. Submit a Callable task for execution, receiving a Future representing that task. The Future will return the Callable's result upon completion. As of 6.1, this method comes with a default implementation that delegates
to | |
| submitListenable | back to summary |
|---|---|
| public ListenableFuture Implements org. Doc from org. Deprecated as a consequence of Submit a
| |
| submitListenable | back to summary |
|---|---|
| public <T> ListenableFuture Implements org. Doc from org. Deprecated as a consequence of Submit a
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Callable | |
| private final ErrorHandler |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public V | call()
Implements java. |
| delegate | back to summary |
|---|---|
| private final Callable<V> delegate | |
| errorHandler | back to summary |
|---|---|
| private final ErrorHandler errorHandler | |
| DelegatingErrorHandlingCallable | back to summary |
|---|---|
| public DelegatingErrorHandlingCallable(Callable<V> delegate, ErrorHandler errorHandler) | |
| call | back to summary |
|---|---|
| public V call() throws Exception Implements java. Doc from java. Computes a result, or throws an exception if unable to do so. | |