Package org.springframework.boot.task
Class 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.
- Since:
- 3.2.0
- Author:
- Stephane Nicoll, Moritz Halbritter
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionadditionalCustomizers(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.
- 
Constructor Details- 
SimpleAsyncTaskSchedulerBuilderpublic SimpleAsyncTaskSchedulerBuilder()
 
- 
- 
Method Details- 
threadNamePrefixSet the prefix to use for the names of newly created threads.- Parameters:
- threadNamePrefix- the thread name prefix to set
- Returns:
- a new builder instance
 
- 
concurrencyLimitSet the concurrency limit.- Parameters:
- concurrencyLimit- the concurrency limit
- Returns:
- a new builder instance
 
- 
virtualThreadsSet whether to use virtual threads.- Parameters:
- virtualThreads- whether to use virtual threads
- Returns:
- a new builder instance
 
- 
taskTerminationTimeoutSet the task termination timeout.- Parameters:
- taskTerminationTimeout- the task termination timeout
- Returns:
- a new builder instance
- Since:
- 3.2.1
 
- 
taskDecoratorSet the task decorator to be used by theSimpleAsyncTaskScheduler.- Parameters:
- taskDecorator- the task decorator to set
- Returns:
- a new builder instance
- Since:
- 3.5.0
 
- 
customizerspublic 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.- Parameters:
- customizers- the customizers to set
- Returns:
- a new builder instance
- See Also:
 
- 
customizerspublic 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.- Parameters:
- customizers- the customizers to set
- Returns:
- a new builder instance
- See Also:
 
- 
additionalCustomizerspublic 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.- Parameters:
- customizers- the customizers to add
- Returns:
- a new builder instance
- See Also:
 
- 
additionalCustomizerspublic 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.- Parameters:
- customizers- the customizers to add
- Returns:
- a new builder instance
- See Also:
 
- 
buildBuild a newSimpleAsyncTaskSchedulerinstance and configure it using this builder.- Returns:
- a configured SimpleAsyncTaskSchedulerinstance.
- See Also:
 
- 
configureConfigure the providedSimpleAsyncTaskSchedulerinstance using this builder.- Type Parameters:
- T- the type of task scheduler
- Parameters:
- taskScheduler- the- SimpleAsyncTaskSchedulerto configure
- Returns:
- the task scheduler instance
- See Also:
 
 
-