• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

线程池配置

开发技术 开发技术 6小时前 3次浏览
@Configuration
@EnableConfigurationProperties(MyThreadProperties.class)
public class MyThreadAutoConfiguration {

@Bean
public ThreadPoolExecutor threadPoolExecutor(MyThreadProperties myThreadProperties){
return new ThreadPoolExecutor(myThreadProperties.getCoreSize(),myThreadProperties.getMaxSize(),myThreadProperties.getKeepLiveTime(), TimeUnit.SECONDS,new LinkedBlockingDeque<>(),
new ThreadPoolExecutor.AbortPolicy());
}

}

程序员灯塔
转载请注明原文链接:线程池配置
喜欢 (0)