Commit d56be410 by 罗志长

去除多余配置

parent 6ff94ce3
package com.makeit.config;
import com.alibaba.ttl.threadpool.TtlExecutors;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Configuration
public class AsyncConfig {
@Bean(name = "asyncTaskExecutor")
public Executor asyncTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(5);
executor.setMaxPoolSize(10);
executor.setQueueCapacity(500);
executor.setThreadNamePrefix("async-service-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.setKeepAliveSeconds(60);
executor.setAllowCoreThreadTimeOut(false);
executor.initialize();
return TtlExecutors.getTtlExecutor(executor);
}
}
...@@ -43,7 +43,6 @@ import javax.annotation.Resource; ...@@ -43,7 +43,6 @@ import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -104,7 +103,7 @@ public class PushCallback implements MqttCallbackExtended { ...@@ -104,7 +103,7 @@ public class PushCallback implements MqttCallbackExtended {
} }
@Override @Override
@Async("asyncTaskExecutor") @Async
public void messageArrived(String topic, MqttMessage message) { public void messageArrived(String topic, MqttMessage message) {
try { try {
// 收到消息并设置返回字符串格式 // 收到消息并设置返回字符串格式
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment