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/21 02:25:39 UTC

[incubator-dubbo] branch dev-metadata updated (701cf26 -> 740b5aa)

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 701cf26  Merge branch 'dev-metadata' of https://github.com/apache/incubator-dubbo into dev-metadata
     new 3845d78  add apiVersion to override url
     new ecc34c2  Fix reExport, check url to registry changed before do register.
     new 740b5aa  remove unnecessary volatile restrict

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:
 .../java/org/apache/dubbo/common/config/Environment.java | 16 ++++++++--------
 .../dubbo/registry/integration/RegistryProtocol.java     | 14 ++++++++++++--
 .../dubbo/registry/integration/parser/ConfigParser.java  |  2 ++
 3 files changed, 22 insertions(+), 10 deletions(-)


[incubator-dubbo] 03/03: remove unnecessary volatile restrict

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 740b5aae832828d16e7bdeb871f430fb0810bb1c
Author: ken.lj <ke...@gmail.com>
AuthorDate: Wed Nov 21 10:25:03 2018 +0800

    remove unnecessary volatile restrict
---
 .../java/org/apache/dubbo/common/config/Environment.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
index 0e77565..efc77d6 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
@@ -29,14 +29,14 @@ import java.util.concurrent.ConcurrentHashMap;
 public class Environment {
     private static final Environment INSTANCE = new Environment();
 
-    private volatile Map<String, PropertiesConfiguration> propertiesConfsHolder = new ConcurrentHashMap<>();
-    private volatile Map<String, SystemConfiguration> systemConfsHolder = new ConcurrentHashMap<>();
-    private volatile Map<String, EnvironmentConfiguration> environmentConfsHolder = new ConcurrentHashMap<>();
-    private volatile Map<String, InmemoryConfiguration> externalConfsHolder = new ConcurrentHashMap<>();
-    private volatile Map<String, InmemoryConfiguration> appExternalConfsHolder = new ConcurrentHashMap<>();
-    private volatile Map<String, CompositeConfiguration> startupCompositeConfsHolder = new ConcurrentHashMap<>();
-
-    private volatile boolean isConfigCenterFirst = true;
+    private Map<String, PropertiesConfiguration> propertiesConfsHolder = new ConcurrentHashMap<>();
+    private Map<String, SystemConfiguration> systemConfsHolder = new ConcurrentHashMap<>();
+    private Map<String, EnvironmentConfiguration> environmentConfsHolder = new ConcurrentHashMap<>();
+    private Map<String, InmemoryConfiguration> externalConfsHolder = new ConcurrentHashMap<>();
+    private Map<String, InmemoryConfiguration> appExternalConfsHolder = new ConcurrentHashMap<>();
+    private Map<String, CompositeConfiguration> startupCompositeConfsHolder = new ConcurrentHashMap<>();
+
+    private boolean isConfigCenterFirst = true;
 
     private Map<String, String> externalConfigurationMap = new HashMap<>();
     private Map<String, String> appExternalConfigurationMap = new HashMap<>();


[incubator-dubbo] 02/03: Fix reExport, check url to registry changed before do register.

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 ecc34c247cfea3724cea64fde9433b25ebcf0fe9
Author: ken.lj <ke...@gmail.com>
AuthorDate: Tue Nov 20 20:19:22 2018 +0800

    Fix reExport, check url to registry changed before do register.
---
 .../dubbo/registry/integration/RegistryProtocol.java       | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java
index 2c4781f..9ad920c 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java
@@ -36,6 +36,7 @@ import org.apache.dubbo.registry.RegistryFactory;
 import org.apache.dubbo.registry.RegistryService;
 import org.apache.dubbo.registry.integration.parser.ConfigParser;
 import org.apache.dubbo.registry.support.ProviderConsumerRegTable;
+import org.apache.dubbo.registry.support.ProviderInvokerWrapper;
 import org.apache.dubbo.rpc.Exporter;
 import org.apache.dubbo.rpc.Invoker;
 import org.apache.dubbo.rpc.Protocol;
@@ -147,6 +148,11 @@ public class RegistryProtocol implements Protocol {
         registry.register(registedProviderUrl);
     }
 
+    public void unregister(URL registryUrl, URL registedProviderUrl) {
+        Registry registry = registryFactory.getRegistry(registryUrl);
+        registry.unregister(registedProviderUrl);
+    }
+
     @Override
     public <T> Exporter<T> export(final Invoker<T> originInvoker) throws RpcException {
         URL registryUrl = getRegistryUrl(originInvoker);
@@ -226,9 +232,13 @@ public class RegistryProtocol implements Protocol {
         final URL registeredProviderUrl = getRegistedProviderUrl(newInvokerUrl, registryUrl);
 
         //decide if we need to re-publish
-        boolean shouldReregister = ProviderConsumerRegTable.getProviderWrapper(originInvoker).isReg();
+        ProviderInvokerWrapper<T> providerInvokerWrapper = ProviderConsumerRegTable.getProviderWrapper(originInvoker);
         ProviderConsumerRegTable.registerProvider(originInvoker, registryUrl, registeredProviderUrl);
-        if (shouldReregister) {
+        /**
+         * Only if the new url going to Registry is different with the previous one should we do unregister and register.
+         */
+        if (providerInvokerWrapper.isReg() && !registeredProviderUrl.equals(providerInvokerWrapper.getProviderUrl())) {
+            unregister(registryUrl, providerInvokerWrapper.getProviderUrl());
             register(registryUrl, registeredProviderUrl);
         }
 


[incubator-dubbo] 01/03: add apiVersion to override url

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 3845d78fafb6cb30ea96193c665ae1771e28751e
Author: ken.lj <ke...@gmail.com>
AuthorDate: Tue Nov 20 20:18:02 2018 +0800

    add apiVersion to override url
---
 .../java/org/apache/dubbo/registry/integration/parser/ConfigParser.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/ConfigParser.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/ConfigParser.java
index 35ef69e..a8464da 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/ConfigParser.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/ConfigParser.java
@@ -49,6 +49,7 @@ public class ConfigParser {
                             .stream()
                             .map(u -> u.addParameter(Constants.CATEGORY_KEY, Constants.APP_DYNAMIC_CONFIGURATORS_CATEGORY))
                             .map(u -> u.addParameter(Constants.ENABLED_KEY, configuratorConfig.isEnabled()))
+                            .map(u -> u.addParameter(Constants.API_VERSION_KEY, configuratorConfig.getApiVersion()))
                             .collect(Collectors.toList())
             ));
         } else { // servcie scope by default.
@@ -56,6 +57,7 @@ public class ConfigParser {
                     serviceItemToUrls(item, configuratorConfig.getKey())
                             .stream()
                             .map(u -> u.addParameter(Constants.ENABLED_KEY, configuratorConfig.isEnabled()))
+                            .map(u -> u.addParameter(Constants.API_VERSION_KEY, configuratorConfig.getApiVersion()))
                             .collect(Collectors.toList()))
             );
         }