Class SimpleThreadPoolTaskExecutor
java.lang.Object
org.quartz.simpl.SimpleThreadPool
org.springframework.scheduling.quartz.SimpleThreadPoolTaskExecutor
- All Implemented Interfaces:
- Executor,- ThreadPool,- DisposableBean,- InitializingBean,- AsyncListenableTaskExecutor,- AsyncTaskExecutor,- TaskExecutor,- SchedulingTaskExecutor
public class SimpleThreadPoolTaskExecutor
extends SimpleThreadPool
implements AsyncListenableTaskExecutor, SchedulingTaskExecutor, InitializingBean, DisposableBean
Subclass of Quartz's SimpleThreadPool that implements Spring's
 
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).
- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
- 
Field SummaryFields inherited from interface org.springframework.core.task.AsyncTaskExecutorTIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.voiddestroy()Invoked by the containingBeanFactoryon destruction of a bean.voidExecute the giventask.voidsetWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown) Set whether to wait for running jobs to complete on shutdown.Future<?>Submit a Runnable task for execution, receiving a Future representing that task.<T> Future<T>Submit a Callable task for execution, receiving a Future representing that task.submitListenable(Runnable task) Submit aRunnabletask for execution, receiving aListenableFuturerepresenting that task.<T> ListenableFuture<T>submitListenable(Callable<T> task) Submit aCallabletask for execution, receiving aListenableFuturerepresenting that task.Methods inherited from class org.quartz.simpl.SimpleThreadPoolblockForAvailableThreads, clearFromBusyWorkersList, createWorkerThreads, getLog, getPoolSize, getThreadCount, getThreadNamePrefix, getThreadPriority, initialize, isMakeThreadsDaemons, isThreadsInheritContextClassLoaderOfInitializingThread, isThreadsInheritGroupOfInitializingThread, makeAvailable, runInThread, setInstanceId, setInstanceName, setMakeThreadsDaemons, setThreadCount, setThreadNamePrefix, setThreadPriority, setThreadsInheritContextClassLoaderOfInitializingThread, setThreadsInheritGroupOfInitializingThread, shutdown, shutdownMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.task.AsyncTaskExecutorexecute, submitCompletable, submitCompletableMethods inherited from interface org.springframework.scheduling.SchedulingTaskExecutorprefersShortLivedTasks
- 
Constructor Details- 
SimpleThreadPoolTaskExecutorpublic SimpleThreadPoolTaskExecutor()
 
- 
- 
Method Details- 
setWaitForJobsToCompleteOnShutdownpublic void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown) Set whether to wait for running jobs to complete on shutdown. Default is "false".- See Also:
 
- 
afterPropertiesSetDescription copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
- Throws:
- SchedulerConfigException
 
- 
executeDescription copied from interface:TaskExecutorExecute the giventask.The call might return immediately if the implementation uses an asynchronous execution strategy, or might block in the case of synchronous execution. - Specified by:
- executein interface- Executor
- Specified by:
- executein interface- TaskExecutor
- Parameters:
- task- the- Runnableto execute (never- null)
 
- 
submitDescription copied from interface:AsyncTaskExecutorSubmit a Runnable task for execution, receiving a Future representing that task. The Future will return anullresult upon completion.As of 6.1, this method comes with a default implementation that delegates to TaskExecutor.execute(Runnable).- Specified by:
- submitin interface- AsyncTaskExecutor
- Parameters:
- task- the- Runnableto execute (never- null)
- Returns:
- a Future representing pending completion of the task
 
- 
submitDescription copied from interface:AsyncTaskExecutorSubmit 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 TaskExecutor.execute(Runnable).- Specified by:
- submitin interface- AsyncTaskExecutor
- Parameters:
- task- the- Callableto execute (never- null)
- Returns:
- a Future representing pending completion of the task
 
- 
submitListenableDescription copied from interface:AsyncListenableTaskExecutorSubmit aRunnabletask for execution, receiving aListenableFuturerepresenting that task. The Future will return anullresult upon completion.- Specified by:
- submitListenablein interface- AsyncListenableTaskExecutor
- Parameters:
- task- the- Runnableto execute (never- null)
- Returns:
- a ListenableFuturerepresenting pending completion of the task
 
- 
submitListenableDescription copied from interface:AsyncListenableTaskExecutorSubmit aCallabletask for execution, receiving aListenableFuturerepresenting that task. The Future will return the Callable's result upon completion.- Specified by:
- submitListenablein interface- AsyncListenableTaskExecutor
- Parameters:
- task- the- Callableto execute (never- null)
- Returns:
- a ListenableFuturerepresenting pending completion of the task
 
- 
destroypublic void destroy()Description copied from interface:DisposableBeanInvoked by the containingBeanFactoryon destruction of a bean.- Specified by:
- destroyin interface- DisposableBean
 
 
-