public class TaskExecutorBuilder
extends java.lang.Object
TaskExecutor. Provides
 convenience methods to set common ThreadPoolTaskExecutor settings and register
 taskDecorator(TaskDecorator)). For advanced configuration, consider using
 TaskExecutorCustomizer.
 
 In a typical auto-configured Spring Boot application this builder is available as a
 bean and can be injected whenever a TaskExecutor is needed.
| Constructor and Description | 
|---|
| TaskExecutorBuilder() | 
| Modifier and Type | Method and Description | 
|---|---|
| TaskExecutorBuilder | additionalCustomizers(java.lang.Iterable<TaskExecutorCustomizer> customizers)Add  TaskExecutorCustomizersthat should be applied
 to theThreadPoolTaskExecutor. | 
| TaskExecutorBuilder | additionalCustomizers(TaskExecutorCustomizer... customizers)Add  TaskExecutorCustomizersthat should be applied
 to theThreadPoolTaskExecutor. | 
| TaskExecutorBuilder | allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)Set whether core threads are allowed to time out. | 
| TaskExecutorBuilder | awaitTermination(boolean awaitTermination)Set whether the executor should wait for scheduled tasks to complete on shutdown,
 not interrupting running tasks and executing all tasks in the queue. | 
| TaskExecutorBuilder | awaitTerminationPeriod(java.time.Duration awaitTerminationPeriod)Set the maximum time the executor is supposed to block on shutdown. | 
| org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor | build()Build a new  ThreadPoolTaskExecutorinstance and configure it using this
 builder. | 
| <T extends org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor> | build(java.lang.Class<T> taskExecutorClass)Build a new  ThreadPoolTaskExecutorinstance of the specified type and
 configure it using this builder. | 
| <T extends org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor> | configure(T taskExecutor)Configure the provided  ThreadPoolTaskExecutorinstance using this builder. | 
| TaskExecutorBuilder | corePoolSize(int corePoolSize)Set the core number of threads. | 
| TaskExecutorBuilder | customizers(java.lang.Iterable<TaskExecutorCustomizer> customizers)Set the  TaskExecutorCustomizersthat should be
 applied to theThreadPoolTaskExecutor. | 
| TaskExecutorBuilder | customizers(TaskExecutorCustomizer... customizers)Set the  TaskExecutorCustomizersthat should be
 applied to theThreadPoolTaskExecutor. | 
| TaskExecutorBuilder | keepAlive(java.time.Duration keepAlive)Set the time limit for which threads may remain idle before being terminated. | 
| TaskExecutorBuilder | maxPoolSize(int maxPoolSize)Set the maximum allowed number of threads. | 
| TaskExecutorBuilder | queueCapacity(int queueCapacity)Set the capacity of the queue. | 
| TaskExecutorBuilder | taskDecorator(org.springframework.core.task.TaskDecorator taskDecorator)Set the  TaskDecoratorto use ornullto not use any. | 
| TaskExecutorBuilder | threadNamePrefix(java.lang.String threadNamePrefix)Set the prefix to use for the names of newly created threads. | 
public TaskExecutorBuilder queueCapacity(int queueCapacity)
maxPoolSize.queueCapacity - the queue capacity to setpublic TaskExecutorBuilder corePoolSize(int corePoolSize)
 Core threads can grow and shrink if allowCoreThreadTimeOut(boolean) is
 enabled.
corePoolSize - the core pool size to setpublic TaskExecutorBuilder maxPoolSize(int maxPoolSize)
queue is full, the pool can expand up to that size to accommodate the load.
 
 If the queue capacity is unbounded, this setting is
 ignored.
maxPoolSize - the max pool size to setpublic TaskExecutorBuilder allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)
allowCoreThreadTimeOut - if core threads are allowed to time outpublic TaskExecutorBuilder keepAlive(java.time.Duration keepAlive)
keepAlive - the keep alive to setpublic TaskExecutorBuilder awaitTermination(boolean awaitTermination)
awaitTermination - whether the executor needs to wait for the tasks to
 complete on shutdownawaitTerminationPeriod(Duration)public TaskExecutorBuilder awaitTerminationPeriod(java.time.Duration awaitTerminationPeriod)
awaitTerminationPeriod - the await termination period to setpublic TaskExecutorBuilder threadNamePrefix(java.lang.String threadNamePrefix)
threadNamePrefix - the thread name prefix to setpublic TaskExecutorBuilder taskDecorator(org.springframework.core.task.TaskDecorator taskDecorator)
TaskDecorator to use or null to not use any.taskDecorator - the task decorator to usepublic TaskExecutorBuilder customizers(TaskExecutorCustomizer... customizers)
TaskExecutorCustomizers that should be
 applied to the ThreadPoolTaskExecutor. Customizers are applied in the order
 that they were added after builder configuration has been applied. Setting this
 value will replace any previously configured customizers.customizers - the customizers to setadditionalCustomizers(TaskExecutorCustomizer...)public TaskExecutorBuilder customizers(java.lang.Iterable<TaskExecutorCustomizer> customizers)
TaskExecutorCustomizers that should be
 applied to the ThreadPoolTaskExecutor. Customizers are applied in the order
 that they were added after builder configuration has been applied. Setting this
 value will replace any previously configured customizers.customizers - the customizers to setadditionalCustomizers(TaskExecutorCustomizer...)public TaskExecutorBuilder additionalCustomizers(TaskExecutorCustomizer... customizers)
TaskExecutorCustomizers that should be applied
 to the ThreadPoolTaskExecutor. Customizers are applied in the order that
 they were added after builder configuration has been applied.customizers - the customizers to addcustomizers(TaskExecutorCustomizer...)public TaskExecutorBuilder additionalCustomizers(java.lang.Iterable<TaskExecutorCustomizer> customizers)
TaskExecutorCustomizers that should be applied
 to the ThreadPoolTaskExecutor. Customizers are applied in the order that
 they were added after builder configuration has been applied.customizers - the customizers to addcustomizers(TaskExecutorCustomizer...)public org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor build()
ThreadPoolTaskExecutor instance and configure it using this
 builder.ThreadPoolTaskExecutor instance.build(Class), 
configure(ThreadPoolTaskExecutor)public <T extends org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor> T build(java.lang.Class<T> taskExecutorClass)
ThreadPoolTaskExecutor instance of the specified type and
 configure it using this builder.T - the type of task executortaskExecutorClass - the template type to createThreadPoolTaskExecutor instance.build(), 
configure(ThreadPoolTaskExecutor)public <T extends org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor> T configure(T taskExecutor)
ThreadPoolTaskExecutor instance using this builder.T - the type of task executortaskExecutor - the ThreadPoolTaskExecutor to configurebuild(), 
build(Class)