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(java.lang.Runnable task) |
void |
execute(java.lang.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> java.util.concurrent.Future<T> |
submit(java.util.concurrent.Callable<T> task) |
java.util.concurrent.Future<?> |
submit(java.lang.Runnable task) |
<T> org.springframework.util.concurrent.ListenableFuture<T> |
submitListenable(java.util.concurrent.Callable<T> task) |
org.springframework.util.concurrent.ListenableFuture<?> |
submitListenable(java.lang.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, shutdown
public void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown)
SimpleThreadPool.shutdown(boolean)
public void afterPropertiesSet() throws SchedulerConfigException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
SchedulerConfigException
public void execute(java.lang.Runnable task)
execute
in interface java.util.concurrent.Executor
execute
in interface org.springframework.core.task.TaskExecutor
public void execute(java.lang.Runnable task, long startTimeout)
execute
in interface org.springframework.core.task.AsyncTaskExecutor
public java.util.concurrent.Future<?> submit(java.lang.Runnable task)
submit
in interface org.springframework.core.task.AsyncTaskExecutor
public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
submit
in interface org.springframework.core.task.AsyncTaskExecutor
public org.springframework.util.concurrent.ListenableFuture<?> submitListenable(java.lang.Runnable task)
submitListenable
in interface org.springframework.core.task.AsyncListenableTaskExecutor
public <T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(java.util.concurrent.Callable<T> task)
submitListenable
in interface org.springframework.core.task.AsyncListenableTaskExecutor
public boolean prefersShortLivedTasks()
prefersShortLivedTasks
in interface org.springframework.scheduling.SchedulingTaskExecutor
public void destroy()
destroy
in interface org.springframework.beans.factory.DisposableBean