Skip to content

Commit

Permalink
feature: hippo4j config model in zookeeper config before check (#1457)
Browse files Browse the repository at this point in the history
  • Loading branch information
xjlgod authored Sep 18, 2023
1 parent 35cf5d8 commit e98b106
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,11 @@ default Map<String, String> getApollo() {
return null;
}

/**
* Get Zookeeper.
*/
default Map<String, String> getZookeeper() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> 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:
Expand Down

0 comments on commit e98b106

Please sign in to comment.