移除webflux依赖

更改调用模式为线程池,取消rabbitMQ队列使用
This commit is contained in:
Luoye_W 2021-07-28 15:54:03 +08:00
parent 3cc4b0992f
commit 531a725592

View File

@ -14,7 +14,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.concurrent.*; import java.util.concurrent.*;
@ -37,9 +36,16 @@ public class Start {
IOutlookService outlookService; IOutlookService outlookService;
@Value("${e5.system.threadPool}") @Value("${e5.system.threadPool}")
private int poolSize = 10; Integer poolSize;
private ExecutorService threadPool = new ThreadPoolExecutor( private ExecutorService threadPool;
@PostConstruct
public void init() {
log.info("清空redis...... ");
redisUtil.delAll();
threadPool = new ThreadPoolExecutor(
//指定了线程池中的线程数量它的数量决定了添加的任务是开辟新的线程去执行还是放到workQueue任务队列中去 //指定了线程池中的线程数量它的数量决定了添加的任务是开辟新的线程去执行还是放到workQueue任务队列中去
poolSize, poolSize,
//指定了线程池中的最大线程数量这个参数会根据你使用的workQueue任务队列的类型决定线程池会开辟的最大线程数量 //指定了线程池中的最大线程数量这个参数会根据你使用的workQueue任务队列的类型决定线程池会开辟的最大线程数量
@ -56,16 +62,9 @@ public class Start {
new CustRejectedExecutionHandler() new CustRejectedExecutionHandler()
); );
@PostConstruct
public void init() {
log.info("清空redis...... ");
redisUtil.delAll();
/* log.info("重新添加队列...... ");
Task.sendTaskOutlookMQALL();*/
} }
@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0 0/1 * * * ? ")
private void distributeTask() { private void distributeTask() {
List<Outlook> runOutlookList = outlookService.findRunOutlookList(); List<Outlook> runOutlookList = outlookService.findRunOutlookList();
CountDownLatch cdl = new CountDownLatch(runOutlookList.size()); CountDownLatch cdl = new CountDownLatch(runOutlookList.size());