Use TaskExecutor instead of ThreadPoolTaskExecutor

Closes gh-22943
This commit is contained in:
Rossen Stoyanchev
2019-05-23 14:26:51 -04:00
parent 0b2fcbfe8a
commit e09c5fd9e5
2 changed files with 17 additions and 12 deletions

View File

@@ -28,6 +28,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.event.SmartApplicationListener;
import org.springframework.core.task.TaskExecutor;
import org.springframework.lang.Nullable;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.converter.ByteArrayMessageConverter;
@@ -139,7 +140,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
}
@Bean
public ThreadPoolTaskExecutor clientInboundChannelExecutor() {
public TaskExecutor clientInboundChannelExecutor() {
TaskExecutorRegistration reg = getClientInboundChannelRegistration().taskExecutor();
ThreadPoolTaskExecutor executor = reg.getTaskExecutor();
executor.setThreadNamePrefix("clientInboundChannel-");
@@ -175,7 +176,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
}
@Bean
public ThreadPoolTaskExecutor clientOutboundChannelExecutor() {
public TaskExecutor clientOutboundChannelExecutor() {
TaskExecutorRegistration reg = getClientOutboundChannelRegistration().taskExecutor();
ThreadPoolTaskExecutor executor = reg.getTaskExecutor();
executor.setThreadNamePrefix("clientOutboundChannel-");
@@ -211,7 +212,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
}
@Bean
public ThreadPoolTaskExecutor brokerChannelExecutor() {
public TaskExecutor brokerChannelExecutor() {
ChannelRegistration reg = getBrokerRegistry().getBrokerChannelRegistration();
ThreadPoolTaskExecutor executor;
if (reg.hasTaskExecutor()) {