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 2020/08/17 06:51:02 UTC

[dubbo] branch 3.0 updated: fix wrong parent module version

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 58e29bc  fix wrong parent module version
58e29bc is described below

commit 58e29bc77d41b18c6078f75800b732a33e579e17
Author: ken.lj <ke...@gmail.com>
AuthorDate: Mon Aug 17 14:50:42 2020 +0800

    fix wrong parent module version
---
 .../dubbo-configcenter-apollo/pom.xml              |  2 +-
 .../dubbo-configcenter-nacos/pom.xml               |  2 +-
 dubbo-filter/dubbo-filter-cache/pom.xml            |  2 +-
 dubbo-filter/dubbo-filter-validation/pom.xml       |  2 +-
 dubbo-metadata/dubbo-metadata-report-redis/pom.xml |  2 +-
 dubbo-registry/dubbo-registry-nacos/pom.xml        |  2 +-
 .../registry/nacos/NacosServiceDiscovery.java      | 24 ++++++++++++++++++----
 7 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/dubbo-configcenter/dubbo-configcenter-apollo/pom.xml b/dubbo-configcenter/dubbo-configcenter-apollo/pom.xml
index 8d3dc0e..3756a95 100644
--- a/dubbo-configcenter/dubbo-configcenter-apollo/pom.xml
+++ b/dubbo-configcenter/dubbo-configcenter-apollo/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.dubbo</groupId>
         <artifactId>dubbo-configcenter</artifactId>
-        <version>2.7.7-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
 
     <artifactId>dubbo-configcenter-apollo</artifactId>
diff --git a/dubbo-configcenter/dubbo-configcenter-nacos/pom.xml b/dubbo-configcenter/dubbo-configcenter-nacos/pom.xml
index 42dcc69..65364b8 100644
--- a/dubbo-configcenter/dubbo-configcenter-nacos/pom.xml
+++ b/dubbo-configcenter/dubbo-configcenter-nacos/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.dubbo</groupId>
         <artifactId>dubbo-configcenter</artifactId>
-        <version>2.7.7-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/dubbo-filter/dubbo-filter-cache/pom.xml b/dubbo-filter/dubbo-filter-cache/pom.xml
index 49f99cf..8241d23 100644
--- a/dubbo-filter/dubbo-filter-cache/pom.xml
+++ b/dubbo-filter/dubbo-filter-cache/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.dubbo</groupId>
         <artifactId>dubbo-filter</artifactId>
-        <version>2.7.7-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
     <artifactId>dubbo-filter-cache</artifactId>
     <packaging>jar</packaging>
diff --git a/dubbo-filter/dubbo-filter-validation/pom.xml b/dubbo-filter/dubbo-filter-validation/pom.xml
index 933f1c9..51d70ae 100644
--- a/dubbo-filter/dubbo-filter-validation/pom.xml
+++ b/dubbo-filter/dubbo-filter-validation/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.dubbo</groupId>
         <artifactId>dubbo-filter</artifactId>
-        <version>2.7.7-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
     <artifactId>dubbo-filter-validation</artifactId>
     <packaging>jar</packaging>
diff --git a/dubbo-metadata/dubbo-metadata-report-redis/pom.xml b/dubbo-metadata/dubbo-metadata-report-redis/pom.xml
index 70bd32d..a743401 100644
--- a/dubbo-metadata/dubbo-metadata-report-redis/pom.xml
+++ b/dubbo-metadata/dubbo-metadata-report-redis/pom.xml
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.apache.dubbo</groupId>
         <artifactId>dubbo-metadata</artifactId>
-        <version>2.7.7-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/dubbo-registry/dubbo-registry-nacos/pom.xml b/dubbo-registry/dubbo-registry-nacos/pom.xml
index f381bba..ab914db 100644
--- a/dubbo-registry/dubbo-registry-nacos/pom.xml
+++ b/dubbo-registry/dubbo-registry-nacos/pom.xml
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.apache.dubbo</groupId>
         <artifactId>dubbo-registry</artifactId>
-        <version>2.7.7-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceDiscovery.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceDiscovery.java
index 91de49d..c7562ad 100644
--- a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceDiscovery.java
+++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceDiscovery.java
@@ -25,6 +25,7 @@ import org.apache.dubbo.registry.client.ServiceInstance;
 import org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener;
 import org.apache.dubbo.registry.nacos.util.NacosNamingServiceUtils;
 
+import com.alibaba.nacos.api.exception.NacosException;
 import com.alibaba.nacos.api.naming.NamingService;
 import com.alibaba.nacos.api.naming.listener.NamingEvent;
 import com.alibaba.nacos.api.naming.pojo.Instance;
@@ -56,6 +57,8 @@ public class NacosServiceDiscovery implements ServiceDiscovery {
 
     private URL registryURL;
 
+    private ServiceInstance instance;
+
     @Override
     public void initialize(URL registryURL) throws Exception {
         this.namingService = createNamingService(registryURL);
@@ -70,6 +73,7 @@ public class NacosServiceDiscovery implements ServiceDiscovery {
 
     @Override
     public void register(ServiceInstance serviceInstance) throws RuntimeException {
+        this.instance = serviceInstance;
         execute(namingService, service -> {
             Instance instance = toInstance(serviceInstance);
             service.registerInstance(instance.getServiceName(), group, instance);
@@ -78,6 +82,7 @@ public class NacosServiceDiscovery implements ServiceDiscovery {
 
     @Override
     public void update(ServiceInstance serviceInstance) throws RuntimeException {
+        this.instance = serviceInstance;
         // TODO: Nacos should support
         unregister(serviceInstance);
         register(serviceInstance);
@@ -112,10 +117,16 @@ public class NacosServiceDiscovery implements ServiceDiscovery {
     public void addServiceInstancesChangedListener(ServiceInstancesChangedListener listener)
             throws NullPointerException, IllegalArgumentException {
         execute(namingService, service -> {
-            service.subscribe(listener.getServiceNames(), e -> { // Register Nacos EventListener
-                if (e instanceof NamingEvent) {
-                    NamingEvent event = (NamingEvent) e;
-                    handleEvent(event, listener);
+            listener.getServiceNames().forEach(serviceName -> {
+                try {
+                    service.subscribe(serviceName, e -> { // Register Nacos EventListener
+                        if (e instanceof NamingEvent) {
+                            NamingEvent event = (NamingEvent) e;
+                            handleEvent(event, listener);
+                        }
+                    });
+                } catch (NacosException e) {
+                    e.printStackTrace();
                 }
             });
         });
@@ -126,6 +137,11 @@ public class NacosServiceDiscovery implements ServiceDiscovery {
         return registryURL;
     }
 
+    @Override
+    public ServiceInstance getLocalInstance() {
+        return instance;
+    }
+
     private void handleEvent(NamingEvent event, ServiceInstancesChangedListener listener) {
         String serviceName = event.getServiceName();
         List<ServiceInstance> serviceInstances = event.getInstances()