use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-boot by spring-projects.
the class TaskSchedulerBuilderTests method additionalCustomizersShouldAddToExisting.
@Test
void additionalCustomizersShouldAddToExisting() {
TaskSchedulerCustomizer customizer1 = mock(TaskSchedulerCustomizer.class);
TaskSchedulerCustomizer customizer2 = mock(TaskSchedulerCustomizer.class);
ThreadPoolTaskScheduler scheduler = this.builder.customizers(customizer1).additionalCustomizers(customizer2).build();
then(customizer1).should().customize(scheduler);
then(customizer2).should().customize(scheduler);
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-boot by spring-projects.
the class TaskSchedulerBuilderTests method customizersShouldBeAppliedLast.
@Test
void customizersShouldBeAppliedLast() {
ThreadPoolTaskScheduler scheduler = spy(new ThreadPoolTaskScheduler());
this.builder.poolSize(4).threadNamePrefix("test-").additionalCustomizers((taskScheduler) -> {
then(taskScheduler).should().setPoolSize(4);
then(taskScheduler).should().setThreadNamePrefix("test-");
});
this.builder.configure(scheduler);
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-boot by spring-projects.
the class TaskSchedulerBuilderTests method awaitTerminationPeriodShouldApply.
@Test
void awaitTerminationPeriodShouldApply() {
Duration period = Duration.ofMinutes(1);
ThreadPoolTaskScheduler executor = this.builder.awaitTerminationPeriod(period).build();
assertThat(executor).hasFieldOrPropertyWithValue("awaitTerminationMillis", period.toMillis());
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project waltz by khartec.
the class DIConfiguration method taskScheduler.
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setDaemon(true);
return scheduler;
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project hub-alert by blackducksoftware.
the class ApplicationConfiguration method taskScheduler.
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setPoolSize(Runtime.getRuntime().availableProcessors());
return threadPoolTaskScheduler;
}
Aggregations