|
|
@ -17,19 +17,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
package cn.hippo4j.example.core.config;
|
|
|
|
package cn.hippo4j.example.core.config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hippo4j.core.executor.DynamicThreadPool;
|
|
|
|
import cn.hippo4j.core.executor.DynamicThreadPool;
|
|
|
|
import cn.hippo4j.core.executor.support.ThreadPoolBuilder;
|
|
|
|
import cn.hippo4j.core.executor.support.ThreadPoolBuilder;
|
|
|
|
import cn.hippo4j.example.core.handler.TaskTraceBuilderHandler;
|
|
|
|
import cn.hippo4j.example.core.handler.TaskTraceBuilderHandler;
|
|
|
|
import cn.hippo4j.example.core.inittest.TaskDecoratorTest;
|
|
|
|
import cn.hippo4j.example.core.inittest.TaskDecoratorTest;
|
|
|
|
import com.alibaba.ttl.threadpool.TtlExecutors;
|
|
|
|
import com.alibaba.ttl.threadpool.TtlExecutors;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.hippo4j.common.constant.Constants.AVAILABLE_PROCESSORS;
|
|
|
|
import static cn.hippo4j.common.constant.Constants.AVAILABLE_PROCESSORS;
|
|
|
|
import static cn.hippo4j.example.core.constant.GlobalTestConstant.MESSAGE_CONSUME;
|
|
|
|
import static cn.hippo4j.example.core.constant.GlobalTestConstant.MESSAGE_CONSUME;
|
|
|
|
import static cn.hippo4j.example.core.constant.GlobalTestConstant.MESSAGE_PRODUCE;
|
|
|
|
import static cn.hippo4j.example.core.constant.GlobalTestConstant.MESSAGE_PRODUCE;
|
|
|
@ -41,7 +41,6 @@ import static cn.hippo4j.example.core.constant.GlobalTestConstant.MESSAGE_PRODUC
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
public class DynamicThreadPoolConfig {
|
|
|
|
public class DynamicThreadPoolConfig {
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
@DynamicThreadPool
|
|
|
|
@DynamicThreadPool
|
|
|
|
public Executor messageConsumeTtlDynamicThreadPool() {
|
|
|
|
public Executor messageConsumeTtlDynamicThreadPool() {
|
|
|
|
String threadPoolId = MESSAGE_CONSUME;
|
|
|
|
String threadPoolId = MESSAGE_CONSUME;
|
|
|
@ -59,7 +58,6 @@ public class DynamicThreadPoolConfig {
|
|
|
|
return ttlExecutor;
|
|
|
|
return ttlExecutor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
@DynamicThreadPool
|
|
|
|
@DynamicThreadPool
|
|
|
|
public ThreadPoolExecutor messageProduceDynamicThreadPool() {
|
|
|
|
public ThreadPoolExecutor messageProduceDynamicThreadPool() {
|
|
|
|
String threadPoolId = MESSAGE_PRODUCE;
|
|
|
|
String threadPoolId = MESSAGE_PRODUCE;
|
|
|
|