public class SimpleThreadPoolTaskExecutor extends SimpleThreadPool implements org.springframework.core.task.AsyncListenableTaskExecutor, org.springframework.scheduling.SchedulingTaskExecutor, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
TaskExecutor interface
and listens to Spring lifecycle callbacks.
Can be shared between a Quartz Scheduler (specified as "taskExecutor") and other TaskExecutor users, or even used completely independent of a Quartz Scheduler (as plain TaskExecutor backend).
SimpleThreadPool,
TaskExecutor,
SchedulerFactoryBean.setTaskExecutor(java.util.concurrent.Executor)| Constructor and Description |
|---|
SimpleThreadPoolTaskExecutor() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
void |
execute(Runnable task) |
void |
execute(Runnable task,
long startTimeout) |
boolean |
prefersShortLivedTasks()
This task executor prefers short-lived work units.
|
void |
setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown)
Set whether to wait for running jobs to complete on shutdown.
|
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> org.springframework.util.concurrent.ListenableFuture<T> |
submitListenable(Callable<T> task) |
org.springframework.util.concurrent.ListenableFuture<?> |
submitListenable(Runnable task) |
blockForAvailableThreads, clearFromBusyWorkersList, createWorkerThreads, getLog, getPoolSize, getThreadCount, getThreadNamePrefix, getThreadPriority, initialize, isMakeThreadsDaemons, isThreadsInheritContextClassLoaderOfInitializingThread, isThreadsInheritGroupOfInitializingThread, makeAvailable, runInThread, setInstanceId, setInstanceName, setMakeThreadsDaemons, setThreadCount, setThreadNamePrefix, setThreadPriority, setThreadsInheritContextClassLoaderOfInitializingThread, setThreadsInheritGroupOfInitializingThread, shutdown, shutdownpublic void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown)
SimpleThreadPool.shutdown(boolean)public void afterPropertiesSet()
throws SchedulerConfigException
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanSchedulerConfigExceptionpublic void execute(Runnable task)
public void execute(Runnable task, long startTimeout)
execute in interface org.springframework.core.task.AsyncTaskExecutorpublic Future<?> submit(Runnable task)
submit in interface org.springframework.core.task.AsyncTaskExecutorpublic <T> Future<T> submit(Callable<T> task)
submit in interface org.springframework.core.task.AsyncTaskExecutorpublic org.springframework.util.concurrent.ListenableFuture<?> submitListenable(Runnable task)
submitListenable in interface org.springframework.core.task.AsyncListenableTaskExecutorpublic <T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(Callable<T> task)
submitListenable in interface org.springframework.core.task.AsyncListenableTaskExecutorpublic boolean prefersShortLivedTasks()
prefersShortLivedTasks in interface org.springframework.scheduling.SchedulingTaskExecutorpublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBean