/* * ******************************************************************************************************************** * * iFHS7. * ;BBMBMBMc rZMBMBR BMB * MBEr:;PBM, 7MBMMEOBB: BBB RBW * XK: BO SB. :SZ MBM. c;; ir BBM :FFr :SSF: ;xBMB:r iuGXv. i:. iF2; * DBBM0r. :D S7 ;XMBMB GMBMu. MBM: BMB MBMBBBMBMS WMBMBMBBK MBMBMBM BMBRBMBW .MBMBMBMBB * :JMRMMD .. , 1MMRM1; ;MBMBBR: MBM ;MB: BMB: MBM. RMBr sBMH BM0 UMB, BMB. KMBv * ;. XOW B1; :uM: 1RE, i .2BMBs rMB. MBO MBO JMB; MBB MBM BBS 7MBMBOBM: MBW :BMc * OBRJ.SEE MRDOWOR, 3DE:7OBM . ;BMB RMR7BM BMB MBB. BMB ,BMR .BBZ MMB rMB, BMM rMB7 * :FBRO0D0 RKXSXPR. JOKOOMPi BMBSSWBMB; BMBB: MBMB0ZMBMS .BMBOXRBMB MBMDE RBM2;SMBM; MBB xBM2 * iZGE O0SHSPO. uGZ7. sBMBMBDL :BMO OZu:BMBK, rRBMB0; ,EBMB xBMBr:ER. RDU :OO; * ,BZ, 1D0 RPSFHXR. xWZ .SMr . .BBB * :0BMRDG RESSSKR. 2WOMBW; BMBMR * i0BM: SWKHKGO MBDv * .UB OOGDM. MK, Copyright (c) 2015-2019. 斯伯坦机器人 * , XMW .. * r All rights reserved. * * ******************************************************************************************************************** */ package com.sybotan.service.config import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.PropertySource import org.springframework.scheduling.annotation.EnableAsync import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor import java.util.concurrent.Executor /** * 异步线程池配置文件 * * @author 庞利祥 */ @Configuration //表明该类是一个配置类 @EnableAsync //开启异步事件的支持 @PropertySource(value = ["classpath:application.properties"], ignoreResourceNotFound = true) open class SAsyncConfig { /** 线程池维护线程的最少数量 */ // @Value("${corePoolSize}") private var corePoolSize = 10 /** 线程池维护线程的最大数量 */ // @Value("${maxPoolSize}") private var maxPoolSize = 50 /** 缓存队列 */ // @Value("${queueCapacity}") private var queueCapacity = 10 /** * 任务执行器 */ @Bean open fun taskExecutor(): Executor { val executor = ThreadPoolTaskExecutor() executor.corePoolSize = corePoolSize executor.maxPoolSize = maxPoolSize executor.setQueueCapacity(queueCapacity) executor.initialize(); return executor } // Function } // Class SAsyncConfig