use of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor in project spring-boot by spring-projects.
the class TaskExecutorBuilderTests method taskDecoratorShouldApply.
@Test
void taskDecoratorShouldApply() {
TaskDecorator taskDecorator = mock(TaskDecorator.class);
ThreadPoolTaskExecutor executor = this.builder.taskDecorator(taskDecorator).build();
assertThat(executor).extracting("taskDecorator").isSameAs(taskDecorator);
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor in project spring-framework by spring-projects.
the class AbstractMessageBrokerConfiguration method clientOutboundChannelExecutor.
@Bean
public TaskExecutor clientOutboundChannelExecutor() {
TaskExecutorRegistration reg = getClientOutboundChannelRegistration().taskExecutor();
ThreadPoolTaskExecutor executor = reg.getTaskExecutor();
executor.setThreadNamePrefix("clientOutboundChannel-");
return executor;
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor in project spring-framework by spring-projects.
the class GenericMessagingTemplateTests method setup.
@BeforeEach
public void setup() {
this.messageChannel = new StubMessageChannel();
this.template = new GenericMessagingTemplate();
this.template.setDefaultDestination(this.messageChannel);
this.template.setDestinationResolver(new TestDestinationResolver());
this.executor = new ThreadPoolTaskExecutor();
this.executor.afterPropertiesSet();
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor in project spring-framework by spring-projects.
the class MessageBrokerConfigurationTests method clientOutboundChannelCustomized.
@Test
public void clientOutboundChannelCustomized() {
ApplicationContext context = loadConfig(CustomConfig.class);
AbstractSubscribableChannel channel = context.getBean("clientOutboundChannel", AbstractSubscribableChannel.class);
assertThat(channel.getInterceptors().size()).isEqualTo(4);
ThreadPoolTaskExecutor taskExecutor = context.getBean("clientOutboundChannelExecutor", ThreadPoolTaskExecutor.class);
assertThat(taskExecutor.getCorePoolSize()).isEqualTo(21);
assertThat(taskExecutor.getMaxPoolSize()).isEqualTo(22);
assertThat(taskExecutor.getKeepAliveSeconds()).isEqualTo(23);
SimpleBrokerMessageHandler broker = context.getBean("simpleBrokerMessageHandler", SimpleBrokerMessageHandler.class);
assertThat(broker.isPreservePublishOrder()).isTrue();
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor in project spring-framework by spring-projects.
the class OrderedMessageChannelDecoratorTests method setup.
@BeforeEach
public void setup() {
this.executor = new ThreadPoolTaskExecutor();
this.executor.setCorePoolSize(Runtime.getRuntime().availableProcessors() * 2);
this.executor.setAllowCoreThreadTimeOut(true);
this.executor.afterPropertiesSet();
this.channel = new ExecutorSubscribableChannel(this.executor);
OrderedMessageChannelDecorator.configureInterceptor(this.channel, true);
this.sender = new OrderedMessageChannelDecorator(this.channel, logger);
}
Aggregations