From b40fc747c00103e2d55c38d85356d6153ec0303a Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Wed, 22 Dec 2021 22:23:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8C=85=E8=A3=85=E5=99=A8?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=90=AF=E5=8A=A8=E6=97=B6=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E6=B1=A0=E4=B8=8D=E5=AE=9E=E6=97=B6=E9=97=AE?= =?UTF-8?q?=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/hippo4j/starter/core/CacheData.java | 7 +++++-- .../starter/core/DynamicThreadPoolPostProcessor.java | 12 +++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/core/CacheData.java b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/core/CacheData.java index 5e37e81f..cf4ae1fd 100644 --- a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/core/CacheData.java +++ b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/core/CacheData.java @@ -70,11 +70,14 @@ public class CacheData { Runnable runnable = () -> { wrap.setLastCallMd5(md5); - listener.receiveConfigInfo(content); }; - listener.getExecutor().execute(runnable); + try { + listener.getExecutor().execute(runnable); + } catch (Exception ex) { + log.error("Failed to execute listener. message :: {}", ex.getMessage()); + } } public void setContent(String content) { diff --git a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/core/DynamicThreadPoolPostProcessor.java b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/core/DynamicThreadPoolPostProcessor.java index 8fe599a8..50116275 100644 --- a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/core/DynamicThreadPoolPostProcessor.java +++ b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/core/DynamicThreadPoolPostProcessor.java @@ -52,10 +52,10 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor { .keepAliveTime(2000) .timeUnit(TimeUnit.MILLISECONDS) .workQueue(QueueTypeEnum.ARRAY_BLOCKING_QUEUE) - .capacity(1) + .capacity(1024) .allowCoreThreadTimeOut(true) - .threadFactory("dynamic-threadPool-init-config") - .rejected(new ThreadPoolExecutor.DiscardOldestPolicy()) + .threadFactory("dynamic-threadPool-change-config") + .rejected(new ThreadPoolExecutor.AbortPolicy()) .build(); @Override @@ -84,10 +84,8 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor { * @param dynamicThreadPoolWrap */ protected void registerAndSubscribe(DynamicThreadPoolWrapper dynamicThreadPoolWrap) { - executorService.execute(() -> { - fillPoolAndRegister(dynamicThreadPoolWrap); - subscribeConfig(dynamicThreadPoolWrap); - }); + fillPoolAndRegister(dynamicThreadPoolWrap); + subscribeConfig(dynamicThreadPoolWrap); } /**