Package org.springframework.scheduling.quartz

# Class SimpleThreadPoolTaskExecutor

java.lang.Object
org.quartz.simpl.SimpleThreadPool
org.springframework.scheduling.quartz.SimpleThreadPoolTaskExecutor

All Implemented Interfaces:
  `Executor`, `ThreadPool`, `org.springframework.beans.factory.DisposableBean`, `org.springframework.beans.factory.InitializingBean`, `org.springframework.core.task.AsyncListenableTaskExecutor`, `org.springframework.core.task.AsyncTaskExecutor`, `org.springframework.core.task.TaskExecutor`, `org.springframework.scheduling.SchedulingTaskExecutor`

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
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)`

## Field Summary

### Fields inherited from interface org.springframework.core.task.AsyncTaskExecutor

`TIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITE`

## Constructor Summary

Constructors
Constructor
Description
`SimpleThreadPoolTaskExecutor()`

## Method Summary

Modifier and Type
Method
Description
`void`
`afterPropertiesSet()`
`void`
`destroy()`
`void`
`execute(Runnable task)`
`void`
`setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown)`
Set whether to wait for running jobs to complete on shutdown.
`Future<?>`
`submit(Runnable task)`
`<T> Future<T>`
`submit(Callable<T> task)`
`org.springframework.util.concurrent.ListenableFuture<?>`
`submitListenable(Runnable task)`
`<T> org.springframework.util.concurrent.ListenableFuture<T>`
`submitListenable(Callable<T> task)`

### Methods inherited from class org.quartz.simpl.SimpleThreadPool

`blockForAvailableThreads, clearFromBusyWorkersList, createWorkerThreads, getLog, getPoolSize, getThreadCount, getThreadNamePrefix, getThreadPriority, initialize, isMakeThreadsDaemons, isThreadsInheritContextClassLoaderOfInitializingThread, isThreadsInheritGroupOfInitializingThread, makeAvailable, runInThread, setInstanceId, setInstanceName, 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`

### Methods inherited from interface org.springframework.core.task.AsyncTaskExecutor

`execute, submitCompletable, submitCompletable`

### Methods inherited from interface org.springframework.scheduling.SchedulingTaskExecutor

`prefersShortLivedTasks`

## Constructor Details

### SimpleThreadPoolTaskExecutor

public SimpleThreadPoolTaskExecutor()

## Method Details

### 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 SchedulerConfigException

Specified by:
  `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
Throws:
  `SchedulerConfigException`

### execute

public void execute(Runnable task)

Specified by:
  `execute` in interface `Executor`
Specified by:
  `execute` in interface `org.springframework.core.task.TaskExecutor`

### submit

public Future<?> submit(Runnable task)

Specified by:
  `submit` in interface `org.springframework.core.task.AsyncTaskExecutor`

### submit

public <T> Future<T> submit(Callable<T> task)

Specified by:
  `submit` in interface `org.springframework.core.task.AsyncTaskExecutor`

### submitListenable

public org.springframework.util.concurrent.ListenableFuture<?> submitListenable(Runnable task)

Specified by:
  `submitListenable` in interface `org.springframework.core.task.AsyncListenableTaskExecutor`

### submitListenable

public <T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(Callable<T> task)

Specified by:
  `submitListenable` in interface `org.springframework.core.task.AsyncListenableTaskExecutor`

### destroy

public void destroy()

Specified by:
  `destroy` in interface `org.springframework.beans.factory.DisposableBean`