You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2019/01/09 07:43:37 UTC
[incubator-dubbo] 05/05: fetch from ConfigManager if ConfigCenter
is not set
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch 2.7.0-release
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
commit 178282cde855ef6a17edcea117226ce3e08b838e
Author: ken.lj <ke...@gmail.com>
AuthorDate: Wed Jan 9 15:43:21 2019 +0800
fetch from ConfigManager if ConfigCenter is not set
---
.../java/org/apache/dubbo/config/AbstractInterfaceConfig.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
index 2c917e4..3d0f025 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
@@ -230,8 +230,13 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
void startConfigCenter() {
- if (configCenter != null) {
- configCenter.refresh();
+ if (configCenter == null) {
+ ConfigManager.getInstance().getConfigCenter().ifPresent(cc -> this.configCenter = cc);
+ }
+
+ if (this.configCenter != null) {
+ // TODO there may have duplicate refresh
+ this.configCenter.refresh();
prepareEnvironment();
}
ConfigManager.getInstance().refreshAll();