diff --git a/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java b/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java index 110c3f5ed1..ab743fd25d 100644 --- a/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java +++ b/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java @@ -94,4 +94,11 @@ default Map getApollo() { return null; } + /** + * Get Zookeeper. + */ + default Map getZookeeper() { + return null; + } + } diff --git a/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java b/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java index e1f6fed108..5265faf68a 100644 --- a/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java +++ b/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java @@ -115,6 +115,35 @@ public BeforeCheckConfiguration.BeforeCheck dynamicThreadPoolBeforeCheckBean(@Au "Please check whether the [spring.dynamic.thread-pool.apollo.namespace] configuration is empty or an empty string."); } } + + Map zookeeper = properties.getZookeeper(); + if (MapUtil.isNotEmpty(zookeeper)) { + String zkConnectStr = zookeeper.get("zk-connect-str"); + if ((StringUtil.isBlank(zkConnectStr))) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool zookeeper zk-connect-str is empty.", + "Please check whether the [spring.dynamic.thread-pool.zookeeper.zk-connect-str] configuration is empty or an empty string."); + } + String configVersion = zookeeper.get("config-version"); + if ((StringUtil.isBlank(configVersion))) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool zookeeper config-version is empty.", + "Please check whether the [spring.dynamic.thread-pool.zookeeper.config-version] configuration is empty or an empty string."); + } + String rootNode = zookeeper.get("root-node"); + if ((StringUtil.isBlank(rootNode))) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool zookeeper root-node is empty.", + "Please check whether the [spring.dynamic.thread-pool.zookeeper.root-node] configuration is empty or an empty string."); + } + String node = zookeeper.get("node"); + if ((StringUtil.isBlank(node))) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool zookeeper node is empty.", + "Please check whether the [spring.dynamic.thread-pool.zookeeper.node] configuration is empty or an empty string."); + } + } + break; } default: