Commit 1297f53e by Nepxion

修复解析远程配置文件的Bug

parent 86e860b1
......@@ -53,23 +53,35 @@ public class ConfigInitializer {
LOG.info("Rule starts to initialize...");
String config = getConfig();
if (StringUtils.isEmpty(config)) {
return;
String remoteConfig = getRemoteConfig();
if (StringUtils.isNotEmpty(remoteConfig)) {
try {
RuleEntity ruleEntity = configParser.parse(remoteConfig);
pluginAdapter.setDynamicRule(ruleEntity);
} catch (Exception e) {
LOG.error("Parse rule xml failed", e);
}
}
String localConfig = getLocalConfig();
if (StringUtils.isNotEmpty(localConfig)) {
try {
RuleEntity ruleEntity = configParser.parse(config);
RuleEntity ruleEntity = configParser.parse(localConfig);
pluginAdapter.setLocalRule(ruleEntity);
} catch (Exception e) {
LOG.error("Parse rule xml failed", e);
}
}
public String getConfig() {
String config = null;
if (StringUtils.isEmpty(remoteConfig) && StringUtils.isEmpty(localConfig)) {
LOG.info("No config is retrieved");
}
}
private String getRemoteConfig() {
if (remoteConfigLoader != null) {
String config = null;
try {
config = remoteConfigLoader.getConfig();
} catch (Exception e) {
......@@ -81,12 +93,18 @@ public class ConfigInitializer {
return config;
} else {
LOG.info("Remote config isn't retrieved, use local config loader");
LOG.info("Remote config isn't retrieved");
}
} else {
LOG.info("Remote config loader isn't provided, use local config loader");
LOG.info("Remote config loader isn't provided");
}
return null;
}
private String getLocalConfig() {
String config = null;
try {
config = localConfigLoader.getConfig();
} catch (Exception e) {
......@@ -101,8 +119,6 @@ public class ConfigInitializer {
LOG.info("Local config isn't retrieved");
}
LOG.info("No config is retrieved");
return null;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment