adapt to 3.0.6-SNAPSHOT (#411)
diff --git a/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/pom.xml b/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/pom.xml
index f9e9c51..0f9c46a 100644
--- a/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/pom.xml
+++ b/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/pom.xml
@@ -40,7 +40,7 @@
<target.level>1.8</target.level>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<spring.version>4.3.16.RELEASE</spring.version>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<junit.version>4.12</junit.version>
</properties>
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/pom.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/pom.xml
index d655313..c30592e 100644
--- a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/pom.xml
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/pom.xml
@@ -36,7 +36,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-cloud-native/servicediscovery-transfer/pom.xml b/dubbo-samples-cloud-native/servicediscovery-transfer/pom.xml
index 5ab8707..db7b09e 100644
--- a/dubbo-samples-cloud-native/servicediscovery-transfer/pom.xml
+++ b/dubbo-samples-cloud-native/servicediscovery-transfer/pom.xml
@@ -41,7 +41,7 @@
<target.level>1.8</target.level>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<spring.version>4.3.16.RELEASE</spring.version>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<junit.version>4.12</junit.version>
</properties>
@@ -69,6 +69,18 @@
</dependencies>
</dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+
<repositories>
<repository>
<id>apache.snapshots.https</id>
diff --git a/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-consumer-old/pom.xml b/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-consumer-old/pom.xml
index 7e26c17..c2e8c39 100644
--- a/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-consumer-old/pom.xml
+++ b/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-consumer-old/pom.xml
@@ -35,50 +35,6 @@
<artifactId>servicediscovery-transfer-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-multicast</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.nacos</groupId>
- <artifactId>nacos-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-zookeeper</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-configcenter-zookeeper</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-configcenter-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-metadata-report-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-config-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-rpc-dubbo</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-remoting-netty4</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-serialization-hessian2</artifactId>
- </dependency>
</dependencies>
<build>
diff --git a/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-consumer/pom.xml b/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-consumer/pom.xml
index 0851c72..95d4f4d 100644
--- a/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-consumer/pom.xml
+++ b/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-consumer/pom.xml
@@ -36,50 +36,6 @@
<artifactId>servicediscovery-transfer-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-multicast</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.nacos</groupId>
- <artifactId>nacos-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-zookeeper</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-configcenter-zookeeper</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-configcenter-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-metadata-report-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-config-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-rpc-dubbo</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-remoting-netty4</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-serialization-hessian2</artifactId>
- </dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-provider/pom.xml b/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-provider/pom.xml
index 7e35bd6..a72a731 100644
--- a/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-provider/pom.xml
+++ b/dubbo-samples-cloud-native/servicediscovery-transfer/servicediscovery-transfer-provider/pom.xml
@@ -39,50 +39,6 @@
<version>${project.parent.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-multicast</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.nacos</groupId>
- <artifactId>nacos-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-registry-zookeeper</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-configcenter-zookeeper</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-configcenter-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-metadata-report-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-rpc-dubbo</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-config-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-remoting-netty4</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-serialization-hessian2</artifactId>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
diff --git a/dubbo-samples-compatible/pom.xml b/dubbo-samples-compatible/pom.xml
index 9d5a4fe..dc89e22 100644
--- a/dubbo-samples-compatible/pom.xml
+++ b/dubbo-samples-compatible/pom.xml
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-metadata-report/dubbo-samples-metadata-report-configcenter/pom.xml b/dubbo-samples-metadata-report/dubbo-samples-metadata-report-configcenter/pom.xml
index 9d42fff..eb4dbc2 100644
--- a/dubbo-samples-metadata-report/dubbo-samples-metadata-report-configcenter/pom.xml
+++ b/dubbo-samples-metadata-report/dubbo-samples-metadata-report-configcenter/pom.xml
@@ -30,7 +30,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-annotation/pom.xml b/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-annotation/pom.xml
index d687447..e95da9c 100644
--- a/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-annotation/pom.xml
+++ b/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-annotation/pom.xml
@@ -30,7 +30,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-properties/pom.xml b/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-properties/pom.xml
index d3437ad..f0b5e22 100644
--- a/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-properties/pom.xml
+++ b/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-properties/pom.xml
@@ -30,7 +30,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-xml/pom.xml b/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-xml/pom.xml
index 26c74bc..f3ff923 100644
--- a/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-xml/pom.xml
+++ b/dubbo-samples-metadata-report/dubbo-samples-metadata-report-local-xml/pom.xml
@@ -30,7 +30,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-spi-compatible/pom.xml b/dubbo-samples-spi-compatible/pom.xml
index d8a6f33..f796e57 100644
--- a/dubbo-samples-spi-compatible/pom.xml
+++ b/dubbo-samples-spi-compatible/pom.xml
@@ -28,7 +28,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2.1</dubbo.version>
+ <dubbo.version>3.0.6-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscovery.java b/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscovery.java
index 64a00f2..e3aaa02 100644
--- a/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscovery.java
+++ b/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscovery.java
@@ -18,59 +18,46 @@
package org.apache.dubbo.samples.basic.spi;
import org.apache.dubbo.common.URL;
-import org.apache.dubbo.registry.client.ServiceDiscovery;
+import org.apache.dubbo.registry.client.AbstractServiceDiscovery;
import org.apache.dubbo.registry.client.ServiceInstance;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+import java.util.Collections;
+import java.util.List;
import java.util.Set;
-public class CompatibleServiceDiscovery implements ServiceDiscovery {
+public class CompatibleServiceDiscovery extends AbstractServiceDiscovery {
- protected ServiceInstance serviceInstance;
+ private ServiceInstance serviceInstance;
+ private URL url;
- protected URL url;
-
- //@Override
- public ServiceInstance getLocalInstance() {
- return serviceInstance;
+ public CompatibleServiceDiscovery(ApplicationModel applicationModel, URL registryURL) {
+ super(applicationModel, registryURL);
+ this.url = registryURL;
}
@Override
- public void register(ServiceInstance serviceInstance) throws RuntimeException {
+ protected void doRegister(ServiceInstance serviceInstance) throws RuntimeException {
this.serviceInstance = serviceInstance;
}
@Override
- public void update(ServiceInstance serviceInstance) throws RuntimeException {
- this.serviceInstance = serviceInstance;
+ protected void doUnregister(ServiceInstance serviceInstance) {
+ this.serviceInstance = null;
}
@Override
- public void initialize(URL registryURL) throws Exception {
- url = registryURL;
- }
-
- @Override
- public void destroy() throws Exception {
-
- }
-
- //For compatible, 3.0 service discovery need isDestroy to judgement.
- public boolean isDestroy() {
- return false;
- }
-
- @Override
- public void unregister(ServiceInstance serviceInstance) throws RuntimeException {
+ protected void doDestroy() throws Exception {
}
@Override
public Set<String> getServices() {
- return null;
+ return Collections.emptySet();
}
@Override
- public URL getUrl() {
- return url;
+ public List<ServiceInstance> getInstances(String serviceName) throws NullPointerException {
+ return Collections.emptyList();
}
}
diff --git a/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscoveryFactory.java b/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscoveryFactory.java
new file mode 100644
index 0000000..73899e0
--- /dev/null
+++ b/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscoveryFactory.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.samples.basic.spi;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.registry.client.AbstractServiceDiscoveryFactory;
+import org.apache.dubbo.registry.client.ServiceDiscovery;
+
+public class CompatibleServiceDiscoveryFactory extends AbstractServiceDiscoveryFactory {
+ @Override
+ protected ServiceDiscovery createDiscovery(URL registryURL) {
+ return new CompatibleServiceDiscovery(applicationModel, registryURL);
+ }
+}
diff --git a/dubbo-samples-spi-compatible/src/main/resources/META-INF/dubbo/org.apache.dubbo.registry.client.ServiceDiscovery b/dubbo-samples-spi-compatible/src/main/resources/META-INF/dubbo/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
similarity index 80%
rename from dubbo-samples-spi-compatible/src/main/resources/META-INF/dubbo/org.apache.dubbo.registry.client.ServiceDiscovery
rename to dubbo-samples-spi-compatible/src/main/resources/META-INF/dubbo/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
index ec41bbd..392f2a9 100644
--- a/dubbo-samples-spi-compatible/src/main/resources/META-INF/dubbo/org.apache.dubbo.registry.client.ServiceDiscovery
+++ b/dubbo-samples-spi-compatible/src/main/resources/META-INF/dubbo/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
@@ -1 +1 @@
-compatible=org.apache.dubbo.samples.basic.spi.CompatibleServiceDiscovery
\ No newline at end of file
+compatible=org.apache.dubbo.samples.basic.spi.CompatibleServiceDiscoveryFactory
\ No newline at end of file