From f42ab65a20970ad3ac750c8f2e7f9147bd377361 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Wed, 1 Dec 2021 22:13:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E6=8D=A2?= =?UTF-8?q?=E4=B8=80=E7=A7=8D=E6=96=B9=E5=BC=8F=E6=B3=A8=E5=85=A5=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E7=BA=BF=E7=A8=8B=E6=B1=A0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hippo4j/example/inittest/RunStateHandlerTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hippo4j-example/src/main/java/cn/hippo4j/example/inittest/RunStateHandlerTest.java b/hippo4j-example/src/main/java/cn/hippo4j/example/inittest/RunStateHandlerTest.java index 2793adf3..b02a3ebd 100644 --- a/hippo4j-example/src/main/java/cn/hippo4j/example/inittest/RunStateHandlerTest.java +++ b/hippo4j-example/src/main/java/cn/hippo4j/example/inittest/RunStateHandlerTest.java @@ -1,12 +1,10 @@ package cn.hippo4j.example.inittest; -import cn.hippo4j.example.constant.GlobalTestConstant; -import cn.hippo4j.starter.core.GlobalThreadPoolManage; -import cn.hippo4j.starter.wrapper.DynamicThreadPoolWrapper; import cn.hutool.core.thread.ThreadUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import javax.annotation.Resource; import java.util.Random; import java.util.concurrent.ThreadPoolExecutor; @@ -20,6 +18,9 @@ import java.util.concurrent.ThreadPoolExecutor; @Component public class RunStateHandlerTest { + @Resource + private ThreadPoolExecutor dynamicThreadPoolExecutor; + // @PostConstruct @SuppressWarnings("all") public void runStateHandlerTest() { @@ -28,10 +29,8 @@ public class RunStateHandlerTest { new Thread(() -> { ThreadUtil.sleep(5000); for (int i = 0; i < Integer.MAX_VALUE; i++) { - DynamicThreadPoolWrapper poolWrapper = GlobalThreadPoolManage.getExecutorService(GlobalTestConstant.MESSAGE_PRODUCE); - ThreadPoolExecutor pool = poolWrapper.getExecutor(); try { - pool.execute(() -> { + dynamicThreadPoolExecutor.execute(() -> { log.info("Thread pool name :: {}, Executing incoming blocking...", Thread.currentThread().getName()); try { int maxRandom = 10;