From a6e8c3cc49bc2cf60592e0cd7aaf9f114603aade Mon Sep 17 00:00:00 2001 From: walker-sheng Date: Thu, 26 Nov 2020 13:35:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E6=B1=A0=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=BA=BF=E7=A8=8B=E6=B1=A0=E6=A0=B8=E5=BF=83?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskExecutorConfiguration.java | 62 ++----------------- 1 file changed, 4 insertions(+), 58 deletions(-) diff --git a/src/main/java/club/joylink/rtss/configuration/TaskExecutorConfiguration.java b/src/main/java/club/joylink/rtss/configuration/TaskExecutorConfiguration.java index 7e7c7fcd1..bf71f6fbb 100644 --- a/src/main/java/club/joylink/rtss/configuration/TaskExecutorConfiguration.java +++ b/src/main/java/club/joylink/rtss/configuration/TaskExecutorConfiguration.java @@ -13,21 +13,6 @@ import java.util.concurrent.ThreadPoolExecutor; @Configuration @EnableAsync public class TaskExecutorConfiguration { - /*** - * 创建仿真异步逻辑执行线程池 - * @return - */ - @Bean("simulationExecutor") - public TaskExecutor simulationExecutor(Environment env) { - ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); - taskExecutor.setThreadNamePrefix("simulation-executor-"); - taskExecutor.setCorePoolSize(1); - taskExecutor.setMaxPoolSize(1); - taskExecutor.setQueueCapacity(10); - taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - taskExecutor.initialize(); - return taskExecutor; - } /*** * 创建新仿真异步逻辑执行线程池 @@ -37,8 +22,8 @@ public class TaskExecutorConfiguration { public TaskExecutor nsExecutor(Environment env) { ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setThreadNamePrefix("ns-executor-"); - taskExecutor.setCorePoolSize(2); - taskExecutor.setMaxPoolSize(2); + taskExecutor.setCorePoolSize(4); + taskExecutor.setMaxPoolSize(4); taskExecutor.setQueueCapacity(100); taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); taskExecutor.initialize(); @@ -53,51 +38,12 @@ public class TaskExecutorConfiguration { public TaskExecutor realDeviceExecutor(Environment env) { ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setThreadNamePrefix("real-device-executor-"); - taskExecutor.setCorePoolSize(1); - taskExecutor.setMaxPoolSize(1); + taskExecutor.setCorePoolSize(4); + taskExecutor.setMaxPoolSize(4); taskExecutor.setQueueCapacity(100); taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); taskExecutor.initialize(); return taskExecutor; } - /*** - * 异步逻辑执行线程池 - * @return - */ - @Bean("commonExecutor") - public TaskExecutor commonExecutor(Environment env) { - ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); - taskExecutor.setThreadNamePrefix("common-executor-"); - taskExecutor.setMaxPoolSize(20); - taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - taskExecutor.initialize(); - return taskExecutor; - } - - - - /**定时任务调度器*/ - @Bean("scheduler") - public ThreadPoolTaskScheduler threadPoolTaskScheduler(){ - return new ThreadPoolTaskScheduler(); - - } - - /*** - * 创建仿真UDP数据处理执行线程池 - * @return - */ - @Bean("socketExecutor") - public TaskExecutor socketExecutor(Environment env) { - ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); - taskExecutor.setThreadNamePrefix("socket-executor-"); - taskExecutor.setCorePoolSize(1); - taskExecutor.setMaxPoolSize(1); - taskExecutor.setQueueCapacity(10); - taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - taskExecutor.initialize(); - return taskExecutor; - } - }