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 2018/11/29 09:06:02 UTC
[incubator-dubbo] branch dev-metadata updated (abb62c8 -> 8f9a76e)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a change to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git.
from abb62c8 add dependency into dubbo.jar
new 14d1f97 optimize dynamic configuration api
new 83a27e8 rename
new 8f9a76e Merge branch 'dev-metadata' of https://github.com/apache/incubator-dubbo into dev-metadata
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../configcenter/AbstractDynamicConfiguration.java | 7 ++++++-
.../dubbo/configcenter/DynamicConfiguration.java | 3 ++-
.../support/apollo/ApolloDynamicConfiguration.java | 18 +++++++++---------
....apache.dubbo.metadata.store.MetadataReportFactory} | 0
4 files changed, 17 insertions(+), 11 deletions(-)
rename dubbo-metadata-report/dubbo-metadata-report-api/src/test/resources/META-INF/dubbo/internal/{org.apache.dubbo.servicedata.store.ServiceStoreFactory => org.apache.dubbo.metadata.store.MetadataReportFactory} (100%)
[incubator-dubbo] 01/03: optimize dynamic configuration api
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
commit 14d1f97ae80a35fe65d9fced488a1fd8bac4f822
Author: ken.lj <ke...@gmail.com>
AuthorDate: Thu Nov 29 17:05:05 2018 +0800
optimize dynamic configuration api
---
.../configcenter/AbstractDynamicConfiguration.java | 7 ++++++-
.../dubbo/configcenter/DynamicConfiguration.java | 3 ++-
.../support/apollo/ApolloDynamicConfiguration.java | 18 +++++++++---------
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java b/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
index 6fcf8c3..4190e1d 100644
--- a/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
+++ b/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
@@ -21,6 +21,7 @@ import org.apache.dubbo.common.config.AbstractConfiguration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* Dynamic configuration template class. The concrete implementation needs to provide implementation for three methods.
@@ -34,6 +35,7 @@ public abstract class AbstractDynamicConfiguration<TargetListener> extends Abstr
protected static final String DEFAULT_GROUP = "dubbo";
protected URL url;
+ private AtomicBoolean inited = new AtomicBoolean(false);
// One key can register multiple target listeners, but one target listener only maps to one configuration listener
protected ConcurrentMap<String, TargetListener> targetListeners =
@@ -44,6 +46,9 @@ public abstract class AbstractDynamicConfiguration<TargetListener> extends Abstr
@Override
public void initWith(URL url) {
+ if (!inited.compareAndSet(false, true)) {
+ return;
+ }
this.url = url;
}
@@ -86,7 +91,7 @@ public abstract class AbstractDynamicConfiguration<TargetListener> extends Abstr
}
@Override
- public void removeListener(String key) {
+ public void removeListener(String key, ConfigurationListener listener) {
}
diff --git a/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/DynamicConfiguration.java b/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/DynamicConfiguration.java
index 83ff936..7e37918 100644
--- a/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/DynamicConfiguration.java
+++ b/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/DynamicConfiguration.java
@@ -35,13 +35,14 @@ public interface DynamicConfiguration extends Configuration {
/**
* Register a configuration listener for a specified key
+ * The listener only works for service governance purpose, so the group would always be 'dubbo'
*
* @param key the key to represent a configuration
* @param listener configuration listener
*/
void addListener(String key, ConfigurationListener listener);
- void removeListener(String key);
+ void removeListener(String key, ConfigurationListener listener);
/**
* Get the configuration mapped to the given key
diff --git a/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java b/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java
index 0c0d95c..6e3b77e 100644
--- a/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java
+++ b/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java
@@ -16,12 +16,6 @@
*/
package org.apache.dubbo.configcenter.support.apollo;
-import com.ctrip.framework.apollo.Config;
-import com.ctrip.framework.apollo.ConfigChangeListener;
-import com.ctrip.framework.apollo.ConfigService;
-import com.ctrip.framework.apollo.enums.ConfigSourceType;
-import com.ctrip.framework.apollo.enums.PropertyChangeType;
-import com.ctrip.framework.apollo.model.ConfigChange;
import org.apache.dubbo.common.Constants;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.logger.Logger;
@@ -32,6 +26,13 @@ import org.apache.dubbo.configcenter.ConfigChangeEvent;
import org.apache.dubbo.configcenter.ConfigChangeType;
import org.apache.dubbo.configcenter.ConfigurationListener;
+import com.ctrip.framework.apollo.Config;
+import com.ctrip.framework.apollo.ConfigChangeListener;
+import com.ctrip.framework.apollo.ConfigService;
+import com.ctrip.framework.apollo.enums.ConfigSourceType;
+import com.ctrip.framework.apollo.enums.PropertyChangeType;
+import com.ctrip.framework.apollo.model.ConfigChange;
+
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -113,13 +114,12 @@ public class ApolloDynamicConfiguration extends AbstractDynamicConfiguration<Apo
@Override
protected void addConfigurationListener(String key, ApolloListener listener, ConfigurationListener configurationListener) {
listener.addListener(configurationListener);
+ this.dubboConfig.addChangeListener(listener);
}
@Override
protected ApolloListener createTargetListener(String key) {
- ApolloListener listener = new ApolloListener();
- this.dubboConfig.addChangeListener(listener);
- return listener;
+ return new ApolloListener();
}
@Override
[incubator-dubbo] 03/03: Merge branch 'dev-metadata' of
https://github.com/apache/incubator-dubbo into dev-metadata
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
commit 8f9a76e0fb2866e6e388ac9b4b44ec8318ef9e18
Merge: 83a27e8 abb62c8
Author: ken.lj <ke...@gmail.com>
AuthorDate: Thu Nov 29 17:05:45 2018 +0800
Merge branch 'dev-metadata' of https://github.com/apache/incubator-dubbo into dev-metadata
dubbo-all/pom.xml | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
[incubator-dubbo] 02/03: rename
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
commit 83a27e894a7975ff31cf2546cbe65cb3ebbb1d63
Author: ken.lj <ke...@gmail.com>
AuthorDate: Thu Nov 29 17:05:34 2018 +0800
rename
---
...StoreFactory => org.apache.dubbo.metadata.store.MetadataReportFactory} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/dubbo-metadata-report/dubbo-metadata-report-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.servicedata.store.ServiceStoreFactory b/dubbo-metadata-report/dubbo-metadata-report-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.metadata.store.MetadataReportFactory
similarity index 100%
rename from dubbo-metadata-report/dubbo-metadata-report-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.servicedata.store.ServiceStoreFactory
rename to dubbo-metadata-report/dubbo-metadata-report-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.metadata.store.MetadataReportFactory