org.springframework.scheduling.quartz
Class SimpleThreadPoolTaskExecutor
java.lang.Object
org.quartz.simpl.SimpleThreadPool
org.springframework.scheduling.quartz.SimpleThreadPoolTaskExecutor
- All Implemented Interfaces:
- java.util.concurrent.Executor, org.quartz.spi.ThreadPool, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.core.task.AsyncTaskExecutor, org.springframework.core.task.TaskExecutor, org.springframework.scheduling.SchedulingTaskExecutor
public class SimpleThreadPoolTaskExecutor
- extends org.quartz.simpl.SimpleThreadPool
- implements org.springframework.scheduling.SchedulingTaskExecutor, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.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:
SimpleThreadPool
,
TaskExecutor
,
SchedulerFactoryBean.setTaskExecutor(java.util.concurrent.Executor)
Fields inherited from interface org.springframework.core.task.AsyncTaskExecutor |
TIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITE |
Methods inherited from class org.quartz.simpl.SimpleThreadPool |
blockForAvailableThreads, createWorkerThreads, getLog, getPoolSize, getThreadCount, getThreadNamePrefix, getThreadPriority, initialize, isMakeThreadsDaemons, isThreadsInheritContextClassLoaderOfInitializingThread, isThreadsInheritGroupOfInitializingThread, makeAvailable, runInThread, setMakeThreadsDaemons, setThreadCount, setThreadNamePrefix, setThreadPriority, setThreadsInheritContextClassLoaderOfInitializingThread, setThreadsInheritGroupOfInitializingThread, shutdown, shutdown |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleThreadPoolTaskExecutor
public SimpleThreadPoolTaskExecutor()
setWaitForJobsToCompleteOnShutdown
public void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown)
- Set whether to wait for running jobs to complete on shutdown.
Default is "false".
- See Also:
SimpleThreadPool.shutdown(boolean)
afterPropertiesSet
public void afterPropertiesSet()
throws org.quartz.SchedulerConfigException
- Specified by:
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
- Throws:
org.quartz.SchedulerConfigException
execute
public void execute(java.lang.Runnable task)
- Specified by:
execute
in interface java.util.concurrent.Executor
- Specified by:
execute
in interface org.springframework.core.task.TaskExecutor
execute
public void execute(java.lang.Runnable task,
long startTimeout)
- Specified by:
execute
in interface org.springframework.core.task.AsyncTaskExecutor
submit
public java.util.concurrent.Future<?> submit(java.lang.Runnable task)
- Specified by:
submit
in interface org.springframework.core.task.AsyncTaskExecutor
submit
public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
- Specified by:
submit
in interface org.springframework.core.task.AsyncTaskExecutor
prefersShortLivedTasks
public boolean prefersShortLivedTasks()
- This task executor prefers short-lived work units.
- Specified by:
prefersShortLivedTasks
in interface org.springframework.scheduling.SchedulingTaskExecutor
destroy
public void destroy()
- Specified by:
destroy
in interface org.springframework.beans.factory.DisposableBean