This is an automated email from the ASF dual-hosted git repository.
huxing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 4ef74fa [Dubbo-3669] Only parse rules on init, does not override.
(#3685)
4ef74fa is described below
commit 4ef74fa9c612975fb86e486ae0206eda81a02e3d
Author: ken.lj <[email protected]>
AuthorDate: Thu May 16 16:59:28 2019 +0800
[Dubbo-3669] Only parse rules on init, does not override. (#3685)
---
.../integration/AbstractConfiguratorListener.java | 24 ++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
index 46beabd..5258d24 100644
---
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
+++
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
@@ -44,7 +44,7 @@ public abstract class AbstractConfiguratorListener implements
ConfigurationListe
dynamicConfiguration.addListener(key, this);
String rawConfig = dynamicConfiguration.getConfig(key,
CommonConstants.DUBBO);
if (!StringUtils.isEmpty(rawConfig)) {
- process(new ConfigChangeEvent(key, rawConfig));
+ genConfiguratorsFromRawRule(rawConfig);
}
}
@@ -58,13 +58,7 @@ public abstract class AbstractConfiguratorListener
implements ConfigurationListe
if (event.getChangeType().equals(ConfigChangeType.DELETED)) {
configurators.clear();
} else {
- try {
- // parseConfigurators will recognize app/service config
automatically.
- configurators =
Configurator.toConfigurators(ConfigParser.parseConfigurators(event.getValue()))
- .orElse(configurators);
- } catch (Exception e) {
- logger.error("Failed to parse raw dynamic config and it will
not take effect, the raw config is: " +
- event.getValue(), e);
+ if (!genConfiguratorsFromRawRule(event.getValue())) {
return;
}
}
@@ -72,6 +66,20 @@ public abstract class AbstractConfiguratorListener
implements ConfigurationListe
notifyOverrides();
}
+ private boolean genConfiguratorsFromRawRule(String rawConfig) {
+ boolean parseSuccess = true;
+ try {
+ // parseConfigurators will recognize app/service config
automatically.
+ configurators =
Configurator.toConfigurators(ConfigParser.parseConfigurators(rawConfig))
+ .orElse(configurators);
+ } catch (Exception e) {
+ logger.error("Failed to parse raw dynamic config and it will not
take effect, the raw config is: " +
+ rawConfig, e);
+ parseSuccess = false;
+ }
+ return parseSuccess;
+ }
+
protected abstract void notifyOverrides();
public List<Configurator> getConfigurators() {