public class TaskSchedulerBuilder extends Object
TaskScheduler
. Provides
convenience methods to set common ThreadPoolTaskScheduler
settings. For
advanced configuration, consider using TaskSchedulerCustomizer
.
In a typical auto-configured Spring Boot application this builder is available as a
bean and can be injected whenever a TaskScheduler
is needed.
Constructor and Description |
---|
TaskSchedulerBuilder(Integer poolSize,
String threadNamePrefix,
Set<TaskSchedulerCustomizer> taskSchedulerCustomizers) |
TaskSchedulerBuilder(TaskSchedulerCustomizer... taskSchedulerCustomizers) |
public TaskSchedulerBuilder(TaskSchedulerCustomizer... taskSchedulerCustomizers)
public TaskSchedulerBuilder(Integer poolSize, String threadNamePrefix, Set<TaskSchedulerCustomizer> taskSchedulerCustomizers)
public TaskSchedulerBuilder poolSize(int poolSize)
poolSize
- the pool size to setpublic TaskSchedulerBuilder threadNamePrefix(String threadNamePrefix)
threadNamePrefix
- the thread name prefix to setpublic TaskSchedulerBuilder customizers(TaskSchedulerCustomizer... taskSchedulerCustomizers)
TaskSchedulerCustomizers
that should be
applied to the ThreadPoolTaskScheduler
. 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.taskSchedulerCustomizers
- the customizers to setadditionalCustomizers(TaskSchedulerCustomizer...)
public TaskSchedulerBuilder customizers(Collection<? extends TaskSchedulerCustomizer> taskSchedulerCustomizers)
taskSchedulerCustomizers
that should be
applied to the ThreadPoolTaskScheduler
. 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.taskSchedulerCustomizers
- the customizers to setadditionalCustomizers(TaskSchedulerCustomizer...)
public TaskSchedulerBuilder additionalCustomizers(TaskSchedulerCustomizer... taskSchedulerCustomizers)
taskSchedulerCustomizers
that should be applied
to the ThreadPoolTaskScheduler
. Customizers are applied in the order that
they were added after builder configuration has been applied.taskSchedulerCustomizers
- the customizers to addcustomizers(TaskSchedulerCustomizer...)
public TaskSchedulerBuilder additionalCustomizers(Collection<? extends TaskSchedulerCustomizer> taskSchedulerCustomizers)
taskSchedulerCustomizers
that should be applied
to the ThreadPoolTaskScheduler
. Customizers are applied in the order that
they were added after builder configuration has been applied.taskSchedulerCustomizers
- the customizers to addcustomizers(TaskSchedulerCustomizer...)
public ThreadPoolTaskScheduler build()
ThreadPoolTaskScheduler
instance and configure it using this
builder.ThreadPoolTaskScheduler
instance.configure(ThreadPoolTaskScheduler)
public <T extends ThreadPoolTaskScheduler> T configure(T taskScheduler)
ThreadPoolTaskScheduler
instance using this builder.T
- the type of task schedulertaskScheduler
- the ThreadPoolTaskScheduler
to configurebuild()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.