From d33a81a367a120a8a54288d1eaf95859a6228583 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Tue, 7 Mar 2023 11:44:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4beanConfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/beanconfig/BeanConfig.java | 41 ---------------------- .../pmapi/todocenter/TodoCenterTest.java | 8 ----- 2 files changed, 49 deletions(-) delete mode 100644 pmapi/src/test/java/com/ningdatech/pmapi/beanconfig/BeanConfig.java diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/beanconfig/BeanConfig.java b/pmapi/src/test/java/com/ningdatech/pmapi/beanconfig/BeanConfig.java deleted file mode 100644 index dcfda4d..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/beanconfig/BeanConfig.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.beanconfig; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.task.TaskExecutor; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.stereotype.Component; - -import java.util.concurrent.ThreadPoolExecutor; - -/** - * 发送工作通知线程池配置 - * - * @author CMM - * @since 2023/02/23 09:53 - */ -@EnableAsync -@Configuration -public class BeanConfig { - @Bean - public TaskExecutor executor() { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - - // 设置核心线程数 - executor.setCorePoolSize(2); - // 设置最大线程数 - executor.setMaxPoolSize(10); - // 设置队列容量 - executor.setQueueCapacity(10); - // 设置线程活跃时间(秒) - executor.setKeepAliveSeconds(800); - // 设置默认线程名称 - executor.setThreadNamePrefix("task-"); - // 设置拒绝策略 - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - // 等待所有任务结束后再关闭线程池 - executor.setWaitForTasksToCompleteOnShutdown(true); - return executor; - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java index a61cf58..4a61788 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java @@ -1,9 +1,7 @@ package com.ningdatech.pmapi.todocenter; -import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.GenericResult; import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.beanconfig.BeanConfig; import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; @@ -11,17 +9,11 @@ import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.zwdd.client.ZwddClient; -import liquibase.pro.packaged.U; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.core.task.TaskExecutor; -import javax.annotation.Resource; import java.util.concurrent.*; -import java.util.function.Supplier; import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.PASS_MSG_TEMPLATE;