修改示例项目创建动态线程池方式.

pull/10/head
chen.ma 3 years ago
parent 6930e451c9
commit 4b49a9efaf

@ -29,7 +29,11 @@ public class ThreadPoolConfig {
*/ */
@Bean @Bean
public DynamicThreadPoolWrapper messageCenterDynamicThreadPool() { public DynamicThreadPoolWrapper messageCenterDynamicThreadPool() {
return new DynamicThreadPoolWrapper(MESSAGE_CONSUME); ThreadPoolExecutor customExecutor = ThreadPoolBuilder.builder()
.dynamicPool()
.threadFactory(MESSAGE_CONSUME)
.build();
return new DynamicThreadPoolWrapper(MESSAGE_CONSUME, customExecutor);
} }
/** /**
@ -42,7 +46,10 @@ public class ThreadPoolConfig {
@Bean @Bean
@DynamicThreadPool @DynamicThreadPool
public ThreadPoolExecutor dynamicThreadPoolExecutor() { public ThreadPoolExecutor dynamicThreadPoolExecutor() {
return ThreadPoolBuilder.builder().threadFactory(MESSAGE_PRODUCE).dynamicPool().build(); return ThreadPoolBuilder.builder()
.threadFactory(MESSAGE_PRODUCE)
.dynamicPool()
.build();
} }
} }

Loading…
Cancel
Save