类 SimpleAsyncTaskSchedulerBuilder
java.lang.Object
org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder
Builder that can be used to configure and create a
SimpleAsyncTaskScheduler.
Provides convenience methods to set common SimpleAsyncTaskScheduler settings.
For advanced configuration, consider using SimpleAsyncTaskSchedulerCustomizer.
In a typical auto-configured Spring Boot application this builder is available as a
bean and can be injected whenever a SimpleAsyncTaskScheduler is needed.
- 从以下版本开始:
- 3.2.0
- 作者:
- Stephane Nicoll, Moritz Halbritter
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明additionalCustomizers(Iterable<? extends SimpleAsyncTaskSchedulerCustomizer> customizers) Addcustomizersthat should be applied to theSimpleAsyncTaskScheduler.additionalCustomizers(SimpleAsyncTaskSchedulerCustomizer... customizers) Addcustomizersthat should be applied to theSimpleAsyncTaskScheduler.build()Build a newSimpleAsyncTaskSchedulerinstance and configure it using this builder.concurrencyLimit(Integer concurrencyLimit) Set the concurrency limit.<T extends SimpleAsyncTaskScheduler>
Tconfigure(T taskScheduler) Configure the providedSimpleAsyncTaskSchedulerinstance using this builder.customizers(Iterable<? extends SimpleAsyncTaskSchedulerCustomizer> customizers) Set thecustomizersthat should be applied to theSimpleAsyncTaskScheduler.customizers(SimpleAsyncTaskSchedulerCustomizer... customizers) Set thecustomizersthat should be applied to theSimpleAsyncTaskScheduler.taskDecorator(TaskDecorator taskDecorator) Set the task decorator to be used by theSimpleAsyncTaskScheduler.taskTerminationTimeout(Duration taskTerminationTimeout) Set the task termination timeout.threadNamePrefix(String threadNamePrefix) Set the prefix to use for the names of newly created threads.virtualThreads(Boolean virtualThreads) Set whether to use virtual threads.
-
构造器详细资料
-
SimpleAsyncTaskSchedulerBuilder
public SimpleAsyncTaskSchedulerBuilder()
-
-
方法详细资料
-
threadNamePrefix
Set the prefix to use for the names of newly created threads.- 参数:
threadNamePrefix- the thread name prefix to set- 返回:
- a new builder instance
-
concurrencyLimit
Set the concurrency limit.- 参数:
concurrencyLimit- the concurrency limit- 返回:
- a new builder instance
-
virtualThreads
Set whether to use virtual threads.- 参数:
virtualThreads- whether to use virtual threads- 返回:
- a new builder instance
-
taskTerminationTimeout
Set the task termination timeout.- 参数:
taskTerminationTimeout- the task termination timeout- 返回:
- a new builder instance
- 从以下版本开始:
- 3.2.1
-
taskDecorator
Set the task decorator to be used by theSimpleAsyncTaskScheduler.- 参数:
taskDecorator- the task decorator to set- 返回:
- a new builder instance
- 从以下版本开始:
- 3.5.0
-
customizers
public SimpleAsyncTaskSchedulerBuilder customizers(SimpleAsyncTaskSchedulerCustomizer... customizers) Set thecustomizersthat should be applied to theSimpleAsyncTaskScheduler. 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 set- 返回:
- a new builder instance
- 另请参阅:
-
customizers
public SimpleAsyncTaskSchedulerBuilder customizers(Iterable<? extends SimpleAsyncTaskSchedulerCustomizer> customizers) Set thecustomizersthat should be applied to theSimpleAsyncTaskScheduler. 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 set- 返回:
- a new builder instance
- 另请参阅:
-
additionalCustomizers
public SimpleAsyncTaskSchedulerBuilder additionalCustomizers(SimpleAsyncTaskSchedulerCustomizer... customizers) Addcustomizersthat should be applied to theSimpleAsyncTaskScheduler. Customizers are applied in the order that they were added after builder configuration has been applied.- 参数:
customizers- the customizers to add- 返回:
- a new builder instance
- 另请参阅:
-
additionalCustomizers
public SimpleAsyncTaskSchedulerBuilder additionalCustomizers(Iterable<? extends SimpleAsyncTaskSchedulerCustomizer> customizers) Addcustomizersthat should be applied to theSimpleAsyncTaskScheduler. Customizers are applied in the order that they were added after builder configuration has been applied.- 参数:
customizers- the customizers to add- 返回:
- a new builder instance
- 另请参阅:
-
build
Build a newSimpleAsyncTaskSchedulerinstance and configure it using this builder.- 返回:
- a configured
SimpleAsyncTaskSchedulerinstance. - 另请参阅:
-
configure
Configure the providedSimpleAsyncTaskSchedulerinstance using this builder.- 类型参数:
T- the type of task scheduler- 参数:
taskScheduler- theSimpleAsyncTaskSchedulerto configure- 返回:
- the task scheduler instance
- 另请参阅:
-