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 ab743fd2..7392ae72 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 @@ -101,4 +101,11 @@ public interface BootstrapPropertiesInterface { return null; } + /** + * Get Polaris. + */ + default Map getPolaris() { + return null; + } + } diff --git a/kernel/dynamic/mode/config/src/main/java/cn/hippo4j/threadpool/dynamic/mode/config/properties/BootstrapConfigProperties.java b/kernel/dynamic/mode/config/src/main/java/cn/hippo4j/threadpool/dynamic/mode/config/properties/BootstrapConfigProperties.java index ea1dc322..ab169dfb 100644 --- a/kernel/dynamic/mode/config/src/main/java/cn/hippo4j/threadpool/dynamic/mode/config/properties/BootstrapConfigProperties.java +++ b/kernel/dynamic/mode/config/src/main/java/cn/hippo4j/threadpool/dynamic/mode/config/properties/BootstrapConfigProperties.java @@ -76,6 +76,11 @@ public class BootstrapConfigProperties implements BootstrapPropertiesInterface { */ private Map etcd; + /** + * polaris config + */ + private Map polaris; + /** * Web config * 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 5265faf6..5d7502a2 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 @@ -144,6 +144,33 @@ public class BeforeCheckConfiguration { } } + Map polaris = properties.getPolaris(); + if (MapUtil.isNotEmpty(polaris)) { + String namespace = polaris.get("namespace"); + if (StringUtil.isBlank(namespace)) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool polaris namespace is empty.", + "Please check whether the [spring.dynamic.thread-pool.polaris.namespace] configuration is empty or an empty string."); + } + String fileGroup = polaris.get("file.group"); + if (StringUtil.isBlank(fileGroup)) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool polaris file group is empty.", + "Please check whether the [spring.dynamic.thread-pool.polaris.file.group] configuration is empty or an empty string."); + } + String fileName = polaris.get("file.name"); + if (StringUtil.isBlank(fileName)) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool polaris file name is empty.", + "Please check whether the [spring.dynamic.thread-pool.polaris.file.name] configuration is empty or an empty string."); + } + String fileType = polaris.get("file.type"); + if (StringUtil.isBlank(fileType)) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool polaris file type is empty.", + "Please check whether the [spring.dynamic.thread-pool.polaris.file.type] configuration is empty or an empty string."); + } + } break; } default: