From 28073f8c3feff1271ca304ee82e74a45365697b0 Mon Sep 17 00:00:00 2001 From: WuLang <48200100+wulangcode@users.noreply.github.com> Date: Wed, 12 Oct 2022 21:54:09 +0800 Subject: [PATCH] feat:register throws error message (#798) --- .../starter/support/DynamicThreadPoolConfigService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/support/DynamicThreadPoolConfigService.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/support/DynamicThreadPoolConfigService.java index ae4e1c23..d66765e4 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/support/DynamicThreadPoolConfigService.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/support/DynamicThreadPoolConfigService.java @@ -45,6 +45,7 @@ import org.springframework.context.ApplicationListener; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ThreadPoolExecutor; import static cn.hippo4j.common.constant.Constants.REGISTER_DYNAMIC_THREAD_POOL_PATH; @@ -89,7 +90,8 @@ public class DynamicThreadPoolConfigService extends AbstractDynamicThreadPoolSer failDynamicThreadPoolRegisterWrapper(registerWrapper); Result registerResult = httpAgent.httpPost(REGISTER_DYNAMIC_THREAD_POOL_PATH, registerWrapper); if (registerResult == null || !registerResult.isSuccess()) { - throw new ServiceException("Dynamic thread pool registration returns error."); + throw new ServiceException("Dynamic thread pool registration returns error." + + Optional.ofNullable(registerResult).map(Result::getMessage).orElse("")); } } catch (Throwable ex) { log.error("Dynamic thread pool registration execution error: {}", threadPoolId, ex);