|
|
|
|
@ -20,14 +20,15 @@ package cn.hippo4j.example.core.inittest;
|
|
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.slf4j.MDC;
|
|
|
|
|
import org.springframework.core.task.TaskExecutor;
|
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
|
import java.util.concurrent.SynchronousQueue;
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import static cn.hippo4j.common.constant.Constants.EXECUTE_TIMEOUT_TRACE;
|
|
|
|
|
|
|
|
|
|
@ -44,8 +45,8 @@ public class RunStateHandlerTest {
|
|
|
|
|
@Resource
|
|
|
|
|
private ThreadPoolExecutor messageProduceDynamicThreadPool;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ThreadPoolTaskExecutor testThreadPoolTaskExecutor;
|
|
|
|
|
/*@Resource
|
|
|
|
|
private ThreadPoolTaskExecutor testSpringThreadPoolTaskExecutor;*/
|
|
|
|
|
|
|
|
|
|
private final ThreadPoolExecutor runStateHandlerTestExecutor = new ThreadPoolExecutor(
|
|
|
|
|
4,
|
|
|
|
|
@ -68,7 +69,7 @@ public class RunStateHandlerTest {
|
|
|
|
|
// Start the dynamic thread pool to simulate running tasks
|
|
|
|
|
runTask(messageConsumeTtlDynamicThreadPool);
|
|
|
|
|
runTask(messageProduceDynamicThreadPool);
|
|
|
|
|
runTask(testThreadPoolTaskExecutor);
|
|
|
|
|
// runTask(testThreadPoolTaskExecutor);
|
|
|
|
|
// Dynamically register thread pool
|
|
|
|
|
ThreadPoolExecutor registerDynamicThreadPool = RegisterDynamicThreadPoolTest.registerDynamicThreadPool("auto-register-dynamic-thread-pool");
|
|
|
|
|
runTask(registerDynamicThreadPool);
|
|
|
|
|
|