From c5a5b64a1031634fd09b6bcc1405b18981d06502 Mon Sep 17 00:00:00 2001 From: cvictory Date: Mon, 29 Oct 2018 19:34:12 +0800 Subject: [PATCH 01/23] release 2.6.5 (#2705) --- CHANGES.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 23d4aba9a97..e8568acb207 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,29 @@ # Release Notes +## 2.6.5 + +Enhancements / Features: + +- [#2655](https://github.com/apache/incubator-dubbo/issues/2655) @Service and @Reference Optimization +- [#1641](https://github.com/apache/incubator-dubbo/issues/1641) [Enhancement] the algorithm of load issue on Windows good first issue help wanted level/easy type/bug +- [#2600](https://github.com/apache/incubator-dubbo/issues/2600) add javadoc to dubbo-all module good first issue help wanted +- [#2560](https://github.com/apache/incubator-dubbo/issues/2560) A empty directory dubbo-config/dubbo-config-spring/src/test/resources/work after package source tgz +- [#2519](https://github.com/apache/incubator-dubbo/issues/2519) Can we make the bom and all module become the child module of dubbo-parent? good first issue help wanted +- [#2235](https://github.com/apache/incubator-dubbo/issues/2235) [Enhancement] Reactor the generation rule for @Service Bean name type/enhancement + + +Bugfixes: + +- [#2063](https://github.com/apache/incubator-dubbo/issues/2063) @Service(register=false) is not work type/bug +- [#1903](https://github.com/apache/incubator-dubbo/issues/1903) Our customized serialization id exceeds the maximum limit, now it cannot work on 2.6.2 anymore. type/bug +- [#2194](https://github.com/apache/incubator-dubbo/issues/2194) Annotation @Reference can't support to export a service with a sync one and an async one type/bug +- [#2522](https://github.com/apache/incubator-dubbo/issues/2522) `org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor#generateReferenceBeanCacheKey` has a bug type/bug +- [#2256](https://github.com/apache/incubator-dubbo/issues/2256) 2.6.x Spring Event & Bugfix +- [#2621](https://github.com/apache/incubator-dubbo/issues/2621) fix #1641, support get system load on windows. +- [pr#2624](https://github.com/apache/incubator-dubbo/pull/2624) Fix incorrect descriptions for dubbo-serialization module + +Issues and Pull Requests, check [milestone-2.6.5](https://github.com/apache/incubator-dubbo/milestone/21). + ## 2.6.4 Enhancements / Features From c84d79f99ffdfd1b7264703dcfa0f7f09a4f9a22 Mon Sep 17 00:00:00 2001 From: cvictory Date: Tue, 30 Oct 2018 14:15:47 +0800 Subject: [PATCH 02/23] 2.6.5 release changes.md (#2708) * release 2.6.5 * release 2.6.5 * release 2.6.5 changes * add 2.6.5 release note * add 2.6.5 release note --- CHANGES.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e8568acb207..0222eab4fa7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,23 +4,28 @@ Enhancements / Features: -- [#2655](https://github.com/apache/incubator-dubbo/issues/2655) @Service and @Reference Optimization -- [#1641](https://github.com/apache/incubator-dubbo/issues/1641) [Enhancement] the algorithm of load issue on Windows good first issue help wanted level/easy type/bug -- [#2600](https://github.com/apache/incubator-dubbo/issues/2600) add javadoc to dubbo-all module good first issue help wanted -- [#2560](https://github.com/apache/incubator-dubbo/issues/2560) A empty directory dubbo-config/dubbo-config-spring/src/test/resources/work after package source tgz -- [#2519](https://github.com/apache/incubator-dubbo/issues/2519) Can we make the bom and all module become the child module of dubbo-parent? good first issue help wanted -- [#2235](https://github.com/apache/incubator-dubbo/issues/2235) [Enhancement] Reactor the generation rule for @Service Bean name type/enhancement - +- @Service and @Reference Optimization [#2655](https://github.com/apache/incubator-dubbo/issues/2655) [#2657](https://github.com/apache/incubator-dubbo/issues/2657) +- [Enhancement] the algorithm of load issue on Windows good first issue help wanted. [#1641](https://github.com/apache/incubator-dubbo/issues/1641) +- add javadoc to dubbo-all module good first issue help wanted. [#2600](https://github.com/apache/incubator-dubbo/issues/2600) +- [Enhancement] Reactor the generation rule for @Service Bean name type/enhancement [#2235](https://github.com/apache/incubator-dubbo/issues/2235) +- Optimize LeastActiveLoadBalance and add weight test case. [#2584](https://github.com/apache/incubator-dubbo/issues/2584) +- Smooth Round Robin selection. [#2647](https://github.com/apache/incubator-dubbo/pull/2647) +- [Enhancement] Resolve the placeholders for sub-properties. [#2297](https://github.com/apache/incubator-dubbo/pull/2297) Bugfixes: -- [#2063](https://github.com/apache/incubator-dubbo/issues/2063) @Service(register=false) is not work type/bug -- [#1903](https://github.com/apache/incubator-dubbo/issues/1903) Our customized serialization id exceeds the maximum limit, now it cannot work on 2.6.2 anymore. type/bug -- [#2194](https://github.com/apache/incubator-dubbo/issues/2194) Annotation @Reference can't support to export a service with a sync one and an async one type/bug -- [#2522](https://github.com/apache/incubator-dubbo/issues/2522) `org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor#generateReferenceBeanCacheKey` has a bug type/bug -- [#2256](https://github.com/apache/incubator-dubbo/issues/2256) 2.6.x Spring Event & Bugfix -- [#2621](https://github.com/apache/incubator-dubbo/issues/2621) fix #1641, support get system load on windows. -- [pr#2624](https://github.com/apache/incubator-dubbo/pull/2624) Fix incorrect descriptions for dubbo-serialization module +- @Service(register=false) is not work. [#2063](https://github.com/apache/incubator-dubbo/issues/2063) +- Our customized serialization id exceeds the maximum limit, now it cannot work on 2.6.2 anymore. [#1903](https://github.com/apache/incubator-dubbo/issues/1903) [#2668](https://github.com/apache/incubator-dubbo/pull/2668) +- Annotation @Reference can't support to export a service with a sync one and an async one . [#2194](https://github.com/apache/incubator-dubbo/issues/2194) +- `org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor#generateReferenceBeanCacheKey` has a bug. [#2522](https://github.com/apache/incubator-dubbo/issues/2522) +- 2.6.x Spring Event & Bugfix. [#2256](https://github.com/apache/incubator-dubbo/issues/2256) +- fix #1641, support get system load on windows. [#2621](https://github.com/apache/incubator-dubbo/issues/2621) +- Fix incorrect descriptions for dubbo-serialization module. [pr#2624](https://github.com/apache/incubator-dubbo/pull/2624) +- A empty directory dubbo-config/dubbo-config-spring/src/test/resources/work after package source tgz. [#2560](https://github.com/apache/incubator-dubbo/issues/2560) +- Fixed 2.6.x branch a minor issue with doConnect not using getConnectTimeout() in NettyClient. [#2622](https://github.com/apache/incubator-dubbo/issues/2622) +- merge fix from 2.7.0 to 2.6.x (if invoker is destroyed due to address refresh from registry, let's allow the current invoke to proceed). [#2680](https://github.com/apache/incubator-dubbo/pull/2680) +- Bean name of @service annotated class does not resolve placeholder. [#1755](https://github.com/apache/incubator-dubbo/issues/1755) + Issues and Pull Requests, check [milestone-2.6.5](https://github.com/apache/incubator-dubbo/milestone/21). From 2af5a6ddbb6c23d5dcf278426e5e155c1cfc7a28 Mon Sep 17 00:00:00 2001 From: cvictory Date: Wed, 31 Oct 2018 10:48:49 +0800 Subject: [PATCH 03/23] modify 2.6.5 release log (replace pr link with issue link) (#2716) * release 2.6.5 * edit release note for 2.6.5 (rewrite log) --- CHANGES.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0222eab4fa7..a9b1e20cdaf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,31 +2,33 @@ ## 2.6.5 -Enhancements / Features: +Enhancements / Features: -- @Service and @Reference Optimization [#2655](https://github.com/apache/incubator-dubbo/issues/2655) [#2657](https://github.com/apache/incubator-dubbo/issues/2657) +- Reactor the generation rule for @Service Bean name [#2235](https://github.com/apache/incubator-dubbo/issues/2235) +- Introduce a new Spring ApplicationEvent for ServiceBean exporting [#2251](https://github.com/apache/incubator-dubbo/issues/2251) - [Enhancement] the algorithm of load issue on Windows good first issue help wanted. [#1641](https://github.com/apache/incubator-dubbo/issues/1641) - add javadoc to dubbo-all module good first issue help wanted. [#2600](https://github.com/apache/incubator-dubbo/issues/2600) - [Enhancement] Reactor the generation rule for @Service Bean name type/enhancement [#2235](https://github.com/apache/incubator-dubbo/issues/2235) -- Optimize LeastActiveLoadBalance and add weight test case. [#2584](https://github.com/apache/incubator-dubbo/issues/2584) -- Smooth Round Robin selection. [#2647](https://github.com/apache/incubator-dubbo/pull/2647) -- [Enhancement] Resolve the placeholders for sub-properties. [#2297](https://github.com/apache/incubator-dubbo/pull/2297) +- Optimize LeastActiveLoadBalance and add weight test case. [#2540](https://github.com/apache/incubator-dubbo/issues/2540) +- Smooth Round Robin selection. [#2578](https://github.com/apache/incubator-dubbo/issues/2578) [#2647](https://github.com/apache/incubator-dubbo/pull/2647) +- [Enhancement] Resolve the placeholders for sub-properties. [#2297](https://github.com/apache/incubator-dubbo/issues/2297) + Bugfixes: - @Service(register=false) is not work. [#2063](https://github.com/apache/incubator-dubbo/issues/2063) -- Our customized serialization id exceeds the maximum limit, now it cannot work on 2.6.2 anymore. [#1903](https://github.com/apache/incubator-dubbo/issues/1903) [#2668](https://github.com/apache/incubator-dubbo/pull/2668) +- Our customized serialization id exceeds the maximum limit, now it cannot work on 2.6.2 anymore. [#1903](https://github.com/apache/incubator-dubbo/issues/1903) +- Consumer throws RpcException after RegistryDirectory notify in high QPS. [#2016](https://github.com/apache/incubator-dubbo/issues/2016) - Annotation @Reference can't support to export a service with a sync one and an async one . [#2194](https://github.com/apache/incubator-dubbo/issues/2194) - `org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor#generateReferenceBeanCacheKey` has a bug. [#2522](https://github.com/apache/incubator-dubbo/issues/2522) - 2.6.x Spring Event & Bugfix. [#2256](https://github.com/apache/incubator-dubbo/issues/2256) -- fix #1641, support get system load on windows. [#2621](https://github.com/apache/incubator-dubbo/issues/2621) -- Fix incorrect descriptions for dubbo-serialization module. [pr#2624](https://github.com/apache/incubator-dubbo/pull/2624) -- A empty directory dubbo-config/dubbo-config-spring/src/test/resources/work after package source tgz. [#2560](https://github.com/apache/incubator-dubbo/issues/2560) -- Fixed 2.6.x branch a minor issue with doConnect not using getConnectTimeout() in NettyClient. [#2622](https://github.com/apache/incubator-dubbo/issues/2622) -- merge fix from 2.7.0 to 2.6.x (if invoker is destroyed due to address refresh from registry, let's allow the current invoke to proceed). [#2680](https://github.com/apache/incubator-dubbo/pull/2680) +- Fix incorrect descriptions for dubbo-serialization module. [#2665](https://github.com/apache/incubator-dubbo/issues/2665) +- A empty directory dubbo-config/dubbo-config-spring/src/test/resources/work after package source tgz. [#2560](https://github.com/apache/incubator-dubbo/issues/2560) +- Fixed 2.6.x branch a minor issue with doConnect not using getConnectTimeout() in NettyClient. (*No issue*). [#2622](https://github.com/apache/incubator-dubbo/pull/2622) - Bean name of @service annotated class does not resolve placeholder. [#1755](https://github.com/apache/incubator-dubbo/issues/1755) + Issues and Pull Requests, check [milestone-2.6.5](https://github.com/apache/incubator-dubbo/milestone/21). ## 2.6.4 From f2d73f7914c03cc95b884b69b3e660ee0a7ae033 Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Mon, 5 Nov 2018 15:24:29 +0800 Subject: [PATCH 04/23] merge https://github.com/apache/incubator-dubbo/pull/2725 (#2734) * merge https://github.com/apache/incubator-dubbo/pull/2725 * fix UT failure * remove useless test * fix unit test failures --- all/pom.xml | 10 +- dubbo-bootstrap/pom.xml | 45 ------- .../dubbo/bootstrap/DubboBootstrap.java | 111 ------------------ .../alibaba/dubbo/config/ProtocolConfig.java | 11 +- dubbo-config/dubbo-config-spring/pom.xml | 7 +- .../dubbo/config/spring/AnnotationBean.java | 23 ++-- .../dubbo/config/spring/ServiceBean.java | 36 +----- .../extension/SpringExtensionFactory.java | 25 ++++ .../status/DataSourceStatusChecker.java | 10 +- .../spring/status/SpringStatusChecker.java | 10 +- .../config/spring/util/BeanFactoryUtils.java | 58 +++++++++ .../DubboApplicationContextInitializer.java | 39 ------ .../initializer/DubboApplicationListener.java | 49 -------- .../main/resources/META-INF/web-fragment.xml | 22 ---- .../DubboApplicationListenerTest.java | 61 ---------- .../status/DataSourceStatusCheckerTest.java | 11 +- .../status/SpringStatusCheckerTest.java | 13 +- ...ubboApplicationContextInitializerTest.java | 87 -------------- .../dubbo-container-spring/pom.xml | 7 +- .../container/spring/SpringContainer.java | 6 +- pom.xml | 1 - 21 files changed, 142 insertions(+), 500 deletions(-) delete mode 100644 dubbo-bootstrap/pom.xml delete mode 100644 dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java create mode 100644 dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/util/BeanFactoryUtils.java delete mode 100644 dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/initializer/DubboApplicationContextInitializer.java delete mode 100644 dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/initializer/DubboApplicationListener.java delete mode 100644 dubbo-config/dubbo-config-spring/src/main/resources/META-INF/web-fragment.xml delete mode 100644 dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/initializer/DubboApplicationListenerTest.java delete mode 100644 dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/initializer/DubboApplicationContextInitializerTest.java diff --git a/all/pom.xml b/all/pom.xml index 39884493871..1de057893db 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -319,13 +319,6 @@ compile true - - com.alibaba - dubbo-bootstrap - ${project.version} - compile - true - com.alibaba hessian-lite @@ -424,7 +417,6 @@ com.alibaba:dubbo-serialization-fst com.alibaba:dubbo-serialization-kryo com.alibaba:dubbo-serialization-jdk - com.alibaba:dubbo-bootstrap @@ -588,4 +580,4 @@ - \ No newline at end of file + diff --git a/dubbo-bootstrap/pom.xml b/dubbo-bootstrap/pom.xml deleted file mode 100644 index ae6440a5bce..00000000000 --- a/dubbo-bootstrap/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - dubbo-parent - com.alibaba - 2.6.5-SNAPSHOT - - 4.0.0 - - dubbo-bootstrap - - - - - com.alibaba - dubbo-config-api - ${project.parent.version} - - - com.alibaba - dubbo-common - ${project.parent.version} - - - com.alibaba - dubbo-registry-api - ${project.parent.version} - - - \ No newline at end of file diff --git a/dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java b/dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java deleted file mode 100644 index 37ec8a304bc..00000000000 --- a/dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.bootstrap; - -import com.alibaba.dubbo.config.DubboShutdownHook; -import com.alibaba.dubbo.config.ServiceConfig; - -import java.util.ArrayList; -import java.util.List; - -/** - * A bootstrap class to easily start and stop Dubbo via programmatic API. - * The bootstrap class will be responsible to cleanup the resources during stop. - */ -public class DubboBootstrap { - - /** - * The list of ServiceConfig - */ - private List serviceConfigList; - - /** - * Whether register the shutdown hook during start? - */ - private final boolean registerShutdownHookOnStart; - - /** - * The shutdown hook used when Dubbo is running under embedded environment - */ - private DubboShutdownHook shutdownHook; - - public DubboBootstrap() { - this(true, DubboShutdownHook.getDubboShutdownHook()); - } - - public DubboBootstrap(boolean registerShutdownHookOnStart) { - this(registerShutdownHookOnStart, DubboShutdownHook.getDubboShutdownHook()); - } - - public DubboBootstrap(boolean registerShutdownHookOnStart, DubboShutdownHook shutdownHook) { - this.serviceConfigList = new ArrayList(); - this.shutdownHook = shutdownHook; - this.registerShutdownHookOnStart = registerShutdownHookOnStart; - } - - /** - * Register service config to bootstrap, which will be called during {@link DubboBootstrap#stop()} - * @param serviceConfig the service - * @return the bootstrap instance - */ - public DubboBootstrap registerServiceConfig(ServiceConfig serviceConfig) { - serviceConfigList.add(serviceConfig); - return this; - } - - public void start() { - if (registerShutdownHookOnStart) { - registerShutdownHook(); - } else { - // DubboShutdown hook has been registered in AbstractConfig, - // we need to remove it explicitly - removeShutdownHook(); - } - for (ServiceConfig serviceConfig: serviceConfigList) { - serviceConfig.export(); - } - } - - public void stop() { - for (ServiceConfig serviceConfig: serviceConfigList) { - serviceConfig.unexport(); - } - shutdownHook.destroyAll(); - if (registerShutdownHookOnStart) { - removeShutdownHook(); - } - } - - /** - * Register the shutdown hook - */ - public void registerShutdownHook() { - Runtime.getRuntime().addShutdownHook(shutdownHook); - } - - /** - * Remove this shutdown hook - */ - public void removeShutdownHook() { - try { - Runtime.getRuntime().removeShutdownHook(shutdownHook); - } - catch (IllegalStateException ex) { - // ignore - VM is already shutting down - } - } -} diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java index b901beddd99..4952dfe70e2 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java @@ -459,13 +459,4 @@ public void destroy() { ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(name).destroy(); } } - - /** - * Just for compatibility. - * It should be deleted in the next major version, say 2.7.x. - */ - @Deprecated - public static void destroyAll() { - DubboShutdownHook.getDubboShutdownHook().destroyAll(); - } -} \ No newline at end of file +} diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml index 7697f6fc934..6284abcc9b4 100644 --- a/dubbo-config/dubbo-config-spring/pom.xml +++ b/dubbo-config/dubbo-config-spring/pom.xml @@ -35,11 +35,6 @@ dubbo-config-api ${project.parent.version} - - com.alibaba - dubbo-bootstrap - ${project.parent.version} - org.springframework spring-beans @@ -167,4 +162,4 @@ --> - \ No newline at end of file + diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java index 6da7ba8b901..722c6d05213 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java @@ -28,7 +28,6 @@ import com.alibaba.dubbo.config.MonitorConfig; import com.alibaba.dubbo.config.ProtocolConfig; import com.alibaba.dubbo.config.ProviderConfig; -import com.alibaba.dubbo.config.ReferenceConfig; import com.alibaba.dubbo.config.RegistryConfig; import com.alibaba.dubbo.config.ServiceConfig; import com.alibaba.dubbo.config.annotation.Reference; @@ -112,17 +111,16 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) @Override public void destroy() { - - // This will only be called for singleton scope bean, and expected to be called by spring shutdown hook when BeanFactory/ApplicationContext destroys. - // We will guarantee dubbo related resources being released with dubbo shutdown hook. - - // for (ServiceConfig serviceConfig : serviceConfigs) { - // try { - // serviceConfig.unexport(); - // } catch (Throwable e) { - // logger.error(e.getMessage(), e); - // } - // } + // no need to destroy here + // see org.apache.dubbo.config.spring.extension.SpringExtensionFactory.ShutdownHookListener + /* + for (ServiceConfig serviceConfig : serviceConfigs) { + try { + serviceConfig.unexport(); + } catch (Throwable e) { + logger.error(e.getMessage(), e); + } + } for (ReferenceConfig referenceConfig : referenceConfigs.values()) { try { @@ -131,6 +129,7 @@ public void destroy() { logger.error(e.getMessage(), e); } } + */ } @Override diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java index 6174d1b752d..4a73082ac6f 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java @@ -38,13 +38,13 @@ import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.context.support.AbstractApplicationContext; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Map; +import static com.alibaba.dubbo.config.spring.util.BeanFactoryUtils.addApplicationListener; + /** * ServiceFactoryBean * @@ -56,8 +56,6 @@ public class ServiceBean extends ServiceConfig implements InitializingBean private static final long serialVersionUID = 213195494150089726L; - private static transient ApplicationContext SPRING_CONTEXT; - private final transient Service service; private transient ApplicationContext applicationContext; @@ -78,34 +76,11 @@ public ServiceBean(Service service) { this.service = service; } - public static ApplicationContext getSpringContext() { - return SPRING_CONTEXT; - } - @Override public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; SpringExtensionFactory.addApplicationContext(applicationContext); - if (applicationContext != null) { - SPRING_CONTEXT = applicationContext; - try { - Method method = applicationContext.getClass().getMethod("addApplicationListener", new Class[]{ApplicationListener.class}); // backward compatibility to spring 2.0.1 - method.invoke(applicationContext, new Object[]{this}); - supportedApplicationListener = true; - } catch (Throwable t) { - if (applicationContext instanceof AbstractApplicationContext) { - try { - Method method = AbstractApplicationContext.class.getDeclaredMethod("addListener", new Class[]{ApplicationListener.class}); // backward compatibility to spring 2.0.1 - if (!method.isAccessible()) { - method.setAccessible(true); - } - method.invoke(applicationContext, new Object[]{this}); - supportedApplicationListener = true; - } catch (Throwable t2) { - } - } - } - } + supportedApplicationListener = addApplicationListener(applicationContext, this); } @Override @@ -303,9 +278,8 @@ private void publishExportEvent() { @Override public void destroy() throws Exception { - // This will only be called for singleton scope bean, and expected to be called by spring shutdown hook when BeanFactory/ApplicationContext destroys. - // We will guarantee dubbo related resources being released with dubbo shutdown hook. - //unexport(); + // no need to call unexport() here, see + // org.apache.dubbo.config.spring.extension.SpringExtensionFactory.ShutdownHookListener } // merged from dubbox diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java index 8673b3925fd..5cbc06e35af 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java @@ -21,9 +21,14 @@ import com.alibaba.dubbo.common.logger.LoggerFactory; import com.alibaba.dubbo.common.utils.ConcurrentHashSet; +import com.alibaba.dubbo.config.DubboShutdownHook; +import com.alibaba.dubbo.config.spring.util.BeanFactoryUtils; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextClosedEvent; import java.util.Set; @@ -35,14 +40,21 @@ public class SpringExtensionFactory implements ExtensionFactory { private static final Set contexts = new ConcurrentHashSet(); + private static final ApplicationListener shutdownHookListener = new ShutdownHookListener(); + public static void addApplicationContext(ApplicationContext context) { contexts.add(context); + BeanFactoryUtils.addApplicationListener(context, shutdownHookListener); } public static void removeApplicationContext(ApplicationContext context) { contexts.remove(context); } + public static Set getContexts() { + return contexts; + } + // currently for test purpose public static void clearContexts() { contexts.clear(); @@ -83,4 +95,17 @@ public T getExtension(Class type, String name) { return null; } + private static class ShutdownHookListener implements ApplicationListener { + @Override + public void onApplicationEvent(ApplicationEvent event) { + if (event instanceof ContextClosedEvent) { + // we call it anyway since dubbo shutdown hook make sure its destroyAll() is re-entrant. + // pls. note we should not remove dubbo shutdown hook when spring framework is present, this is because + // its shutdown hook may not be installed. + DubboShutdownHook shutdownHook = DubboShutdownHook.getDubboShutdownHook(); + shutdownHook.destroyAll(); + } + } + } + } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusChecker.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusChecker.java index fd0e32ded7f..32baa41da48 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusChecker.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusChecker.java @@ -21,8 +21,8 @@ import com.alibaba.dubbo.common.logger.LoggerFactory; import com.alibaba.dubbo.common.status.Status; import com.alibaba.dubbo.common.status.StatusChecker; -import com.alibaba.dubbo.config.spring.ServiceBean; +import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory; import org.springframework.context.ApplicationContext; import javax.sql.DataSource; @@ -42,7 +42,13 @@ public class DataSourceStatusChecker implements StatusChecker { @Override @SuppressWarnings("unchecked") public Status check() { - ApplicationContext context = ServiceBean.getSpringContext(); + ApplicationContext context = null; + for (ApplicationContext c : SpringExtensionFactory.getContexts()) { + if (c != null) { + context = c; + break; + } + } if (context == null) { return new Status(Status.Level.UNKNOWN); } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/status/SpringStatusChecker.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/status/SpringStatusChecker.java index f722c913e7c..f80b5e6b806 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/status/SpringStatusChecker.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/status/SpringStatusChecker.java @@ -21,8 +21,8 @@ import com.alibaba.dubbo.common.logger.LoggerFactory; import com.alibaba.dubbo.common.status.Status; import com.alibaba.dubbo.common.status.StatusChecker; -import com.alibaba.dubbo.config.spring.ServiceBean; +import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.Lifecycle; @@ -38,7 +38,13 @@ public class SpringStatusChecker implements StatusChecker { @Override public Status check() { - ApplicationContext context = ServiceBean.getSpringContext(); + ApplicationContext context = null; + for (ApplicationContext c : SpringExtensionFactory.getContexts()) { + if (c != null) { + context = c; + break; + } + } if (context == null) { return new Status(Status.Level.UNKNOWN); } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/util/BeanFactoryUtils.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/util/BeanFactoryUtils.java new file mode 100644 index 00000000000..13a3011c0d8 --- /dev/null +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/util/BeanFactoryUtils.java @@ -0,0 +1,58 @@ +/* + * 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 com.alibaba.dubbo.config.spring.util; + +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationListener; +import org.springframework.context.support.AbstractApplicationContext; + +import java.lang.reflect.Method; + +/** + * {@link BeanFactory} Utilities class + * + * @see BeanFactory + * @see ConfigurableBeanFactory + * @see org.springframework.beans.factory.BeanFactoryUtils + */ +public class BeanFactoryUtils { + public static boolean addApplicationListener(ApplicationContext applicationContext, ApplicationListener listener) { + try { + // backward compatibility to spring 2.0.1 + Method method = applicationContext.getClass().getMethod("addApplicationListener", ApplicationListener.class); + method.invoke(applicationContext, listener); + return true; + } catch (Throwable t) { + if (applicationContext instanceof AbstractApplicationContext) { + try { + // backward compatibility to spring 2.0.1 + Method method = AbstractApplicationContext.class.getDeclaredMethod("addListener", ApplicationListener.class); + if (!method.isAccessible()) { + method.setAccessible(true); + } + method.invoke(applicationContext, listener); + return true; + } catch (Throwable t2) { + // ignore + } + } + } + return false; + } +} diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/initializer/DubboApplicationContextInitializer.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/initializer/DubboApplicationContextInitializer.java deleted file mode 100644 index 36727e669f4..00000000000 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/initializer/DubboApplicationContextInitializer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.config.spring.initializer; - -import org.springframework.context.ApplicationContextInitializer; -import org.springframework.context.ConfigurableApplicationContext; - -/** - * Automatically register {@link DubboApplicationListener} to Spring context - * A {@link org.springframework.web.context.ContextLoaderListener} class is defined in - * src/main/resources/META-INF/web-fragment.xml - * In the web-fragment.xml, {@link DubboApplicationContextInitializer} is defined in context params. - * This file will be discovered if running under a servlet 3.0+ container. - * Even if user specifies {@link org.springframework.web.context.ContextLoaderListener} in web.xml, - * it will be merged to web.xml. - * If user specifies in web.xml, this will no take effect, - * unless user configures {@link DubboApplicationContextInitializer} explicitly in web.xml. - */ -public class DubboApplicationContextInitializer implements ApplicationContextInitializer { - - @Override - public void initialize(ConfigurableApplicationContext applicationContext) { - applicationContext.addApplicationListener(new DubboApplicationListener()); - } -} diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/initializer/DubboApplicationListener.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/initializer/DubboApplicationListener.java deleted file mode 100644 index 8b6409bd65f..00000000000 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/initializer/DubboApplicationListener.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.config.spring.initializer; - -import org.apache.dubbo.bootstrap.DubboBootstrap; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextClosedEvent; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * An application listener that listens the ContextClosedEvent. - * Upon the event, this listener will do the necessary clean up to avoid memory leak. - */ -public class DubboApplicationListener implements ApplicationListener { - - private DubboBootstrap dubboBootstrap; - - public DubboApplicationListener() { - dubboBootstrap = new DubboBootstrap(false); - } - - public DubboApplicationListener(DubboBootstrap dubboBootstrap) { - this.dubboBootstrap = dubboBootstrap; - } - - @Override - public void onApplicationEvent(ApplicationEvent applicationEvent) { - if (applicationEvent instanceof ContextRefreshedEvent) { - dubboBootstrap.start(); - } else if (applicationEvent instanceof ContextClosedEvent) { - dubboBootstrap.stop(); - } - } -} diff --git a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/web-fragment.xml b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/web-fragment.xml deleted file mode 100644 index 220874ab78c..00000000000 --- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/web-fragment.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - dubbo-fragment - - - - - - - - - contextInitializerClasses - org.apache.dubbo.config.spring.initializer.DubboApplicationContextInitializer - - - - org.springframework.web.context.ContextLoaderListener - - - \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/initializer/DubboApplicationListenerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/initializer/DubboApplicationListenerTest.java deleted file mode 100644 index 9220ce91768..00000000000 --- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/initializer/DubboApplicationListenerTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 com.alibaba.dubbo.config.spring.initializer; - -import com.alibaba.dubbo.config.DubboShutdownHook; - -import org.apache.dubbo.bootstrap.DubboBootstrap; -import org.apache.dubbo.config.spring.initializer.DubboApplicationListener; -import org.junit.Test; -import org.mockito.Mockito; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class DubboApplicationListenerTest { - - @Test - public void testTwoShutdownHook() { - DubboShutdownHook spyHook = Mockito.spy(DubboShutdownHook.getDubboShutdownHook()); - ClassPathXmlApplicationContext applicationContext = getApplicationContext(spyHook, true); - applicationContext.refresh(); - applicationContext.close(); - // shutdown hook can't be verified, because it will executed after main thread has finished. - // so we can only verify it by manually run it. - try { - spyHook.start(); - spyHook.join(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - Mockito.verify(spyHook, Mockito.times(2)).destroyAll(); - } - - @Test - public void testOneShutdownHook() { - DubboShutdownHook spyHook = Mockito.spy(DubboShutdownHook.getDubboShutdownHook()); - ClassPathXmlApplicationContext applicationContext = getApplicationContext(spyHook, false); - applicationContext.refresh(); - applicationContext.close(); - Mockito.verify(spyHook, Mockito.times(1)).destroyAll(); - } - - private ClassPathXmlApplicationContext getApplicationContext(DubboShutdownHook hook, boolean registerHook) { - DubboBootstrap bootstrap = new DubboBootstrap(registerHook, hook); - ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(); - applicationContext.addApplicationListener(new DubboApplicationListener(bootstrap)); - return applicationContext; - } -} diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java index 178f32c5deb..264a843043c 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java @@ -19,10 +19,13 @@ import com.alibaba.dubbo.common.status.Status; import com.alibaba.dubbo.config.spring.ServiceBean; +import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Answers; import org.mockito.Mock; +import org.mockito.Mockito; import org.springframework.context.ApplicationContext; import javax.sql.DataSource; @@ -47,11 +50,17 @@ public class DataSourceStatusCheckerTest { @Before public void setUp() throws Exception { + SpringExtensionFactory.clearContexts(); initMocks(this); this.dataSourceStatusChecker = new DataSourceStatusChecker(); new ServiceBean().setApplicationContext(applicationContext); } + @After + public void tearDown() throws Exception { + Mockito.reset(applicationContext); + } + @Test public void testWithoutApplicationContext() { Status status = dataSourceStatusChecker.check(); @@ -98,4 +107,4 @@ public void testWithDatasourceNotHasNextResult() throws SQLException { assertThat(status.getLevel(), is(Status.Level.ERROR)); } -} \ No newline at end of file +} diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java index 39f91257246..cc9038880b5 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java @@ -19,9 +19,12 @@ import com.alibaba.dubbo.common.status.Status; import com.alibaba.dubbo.config.spring.ServiceBean; +import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.mockito.Mockito; import org.springframework.context.ApplicationContext; import org.springframework.context.Lifecycle; @@ -44,6 +47,12 @@ public void setUp() throws Exception { new ServiceBean().setApplicationContext(applicationContext); } + @After + public void tearDown() throws Exception { + SpringExtensionFactory.clearContexts(); + Mockito.reset(applicationContext); + } + @Test public void testWithoutApplicationContext() { Status status = springStatusChecker.check(); @@ -53,6 +62,7 @@ public void testWithoutApplicationContext() { @Test public void testWithLifeCycleRunning() { + SpringExtensionFactory.clearContexts(); ApplicationLifeCycle applicationLifeCycle = mock(ApplicationLifeCycle.class); new ServiceBean().setApplicationContext(applicationLifeCycle); given(applicationLifeCycle.getConfigLocations()).willReturn(new String[]{"test1", "test2"}); @@ -66,6 +76,7 @@ public void testWithLifeCycleRunning() { @Test public void testWithoutLifeCycleRunning() { + SpringExtensionFactory.clearContexts(); ApplicationLifeCycle applicationLifeCycle = mock(ApplicationLifeCycle.class); new ServiceBean().setApplicationContext(applicationLifeCycle); given(applicationLifeCycle.isRunning()).willReturn(false); @@ -78,4 +89,4 @@ public void testWithoutLifeCycleRunning() { interface ApplicationLifeCycle extends Lifecycle, ApplicationContext { String[] getConfigLocations(); } -} \ No newline at end of file +} diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/initializer/DubboApplicationContextInitializerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/initializer/DubboApplicationContextInitializerTest.java deleted file mode 100644 index b5b8f8c9a9b..00000000000 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/initializer/DubboApplicationContextInitializerTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.config.spring.initializer; - -import org.apache.catalina.core.StandardContext; -import org.apache.catalina.startup.ContextConfig; -import org.apache.catalina.startup.Tomcat; -import org.junit.Assert; -import org.junit.Test; -import org.springframework.web.context.ContextLoaderListener; - - -public class DubboApplicationContextInitializerTest { - - @Test - public void testSpringContextLoaderListenerInWebXml() throws Exception { - Tomcat tomcat = new Tomcat(); - tomcat.setBaseDir("target/test-classes"); - tomcat.setPort(12345); - StandardContext context = new StandardContext(); - context.setName("test"); - context.setDocBase("test"); - context.setPath("/test"); - context.addLifecycleListener(new ContextConfig()); - tomcat.getHost().addChild(context); - tomcat.start(); - // there should be 1 application listener - Assert.assertEquals(1, context.getApplicationLifecycleListeners().length); - // the first one should be Spring's built in ContextLoaderListener. - Assert.assertTrue(context.getApplicationLifecycleListeners()[0] instanceof ContextLoaderListener); - tomcat.stop(); - tomcat.destroy(); - } - - @Test - public void testNoListenerInWebXml() throws Exception { - Tomcat tomcat = new Tomcat(); - tomcat.setBaseDir("target/test-classes"); - tomcat.setPort(12345); - StandardContext context = new StandardContext(); - context.setName("test2"); - context.setDocBase("test2"); - context.setPath("/test2"); - context.addLifecycleListener(new ContextConfig()); - tomcat.getHost().addChild(context); - tomcat.start(); - // there should be 1 application listener - Assert.assertEquals(1, context.getApplicationLifecycleListeners().length); - // the first one should be Spring's built in ContextLoaderListener. - Assert.assertTrue(context.getApplicationLifecycleListeners()[0] instanceof ContextLoaderListener); - tomcat.stop(); - tomcat.destroy(); - } - - @Test - public void testMetadataComplete() throws Exception { - Tomcat tomcat = new Tomcat(); - tomcat.setBaseDir("target/test-classes"); - tomcat.setPort(12345); - StandardContext context = new StandardContext(); - context.setName("test3"); - context.setDocBase("test3"); - context.setPath("/test3"); - context.addLifecycleListener(new ContextConfig()); - tomcat.getHost().addChild(context); - tomcat.start(); - // there should be no application listeners - Assert.assertEquals(0, context.getApplicationLifecycleListeners().length); - tomcat.stop(); - tomcat.destroy(); - } - -} diff --git a/dubbo-container/dubbo-container-spring/pom.xml b/dubbo-container/dubbo-container-spring/pom.xml index 0af93dcbf45..642ef312ffa 100644 --- a/dubbo-container/dubbo-container-spring/pom.xml +++ b/dubbo-container/dubbo-container-spring/pom.xml @@ -38,10 +38,5 @@ org.springframework spring-context - - com.alibaba - dubbo-config-spring - ${project.parent.version} - - \ No newline at end of file + diff --git a/dubbo-container/dubbo-container-spring/src/main/java/com/alibaba/dubbo/container/spring/SpringContainer.java b/dubbo-container/dubbo-container-spring/src/main/java/com/alibaba/dubbo/container/spring/SpringContainer.java index b5866f57c75..d21f3a5636f 100644 --- a/dubbo-container/dubbo-container-spring/src/main/java/com/alibaba/dubbo/container/spring/SpringContainer.java +++ b/dubbo-container/dubbo-container-spring/src/main/java/com/alibaba/dubbo/container/spring/SpringContainer.java @@ -21,7 +21,6 @@ import com.alibaba.dubbo.common.utils.ConfigUtils; import com.alibaba.dubbo.container.Container; -import org.apache.dubbo.config.spring.initializer.DubboApplicationListener; import org.springframework.context.support.ClassPathXmlApplicationContext; /** @@ -44,10 +43,7 @@ public void start() { if (configPath == null || configPath.length() == 0) { configPath = DEFAULT_SPRING_CONFIG; } - context = new ClassPathXmlApplicationContext(configPath.split("[,\\s]+"), false); - context.addApplicationListener(new DubboApplicationListener()); - context.registerShutdownHook(); - context.refresh(); + context = new ClassPathXmlApplicationContext(configPath.split("[,\\s]+")); context.start(); } diff --git a/pom.xml b/pom.xml index f12a635924b..f5a85b118d7 100644 --- a/pom.xml +++ b/pom.xml @@ -138,7 +138,6 @@ dubbo-demo dubbo-plugin dubbo-serialization - dubbo-bootstrap dependencies-bom bom all From 5da01b1d278bc723152e0ef7139b1b1fdab562f8 Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Wed, 7 Nov 2018 14:24:53 +0800 Subject: [PATCH 05/23] =?UTF-8?q?[DUBBO-2489]=20MockClusterInvoker=20provi?= =?UTF-8?q?des=20local=20forced=20mock=EF=BC=8CI=20tested=20it=20locally,?= =?UTF-8?q?=20but=20it=20doesn't=20work=20(#2739)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alibaba/dubbo/config/AbstractConfig.java | 2 +- .../dubbo/config/AbstractInterfaceConfig.java | 53 ++++--- .../dubbo/config/AbstractMethodConfig.java | 10 +- .../alibaba/dubbo/config/ReferenceConfig.java | 3 +- .../alibaba/dubbo/config/ServiceConfig.java | 3 +- .../dubbo/config/AbstractConfigTest.java | 3 +- .../config/AbstractInterfaceConfigTest.java | 27 ++-- .../dubbo/rpc/support/MockInvoker.java | 144 +++++++++++------- 8 files changed, 151 insertions(+), 94 deletions(-) diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java index 782215debcc..548205eb66c 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java @@ -56,7 +56,7 @@ public abstract class AbstractConfig implements Serializable { private static final Pattern PATTERN_PATH = Pattern.compile("[/\\-$._0-9a-zA-Z]+"); - private static final Pattern PATTERN_NAME_HAS_SYMBOL = Pattern.compile("[:*,/\\-._0-9a-zA-Z]+"); + private static final Pattern PATTERN_NAME_HAS_SYMBOL = Pattern.compile("[:*,\\s/\\-._0-9a-zA-Z]+"); private static final Pattern PATTERN_KEY = Pattern.compile("[*,\\-._0-9a-zA-Z]+"); private static final Map legacyProperties = new HashMap(); diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java index 87b50ebd971..4eec460c64d 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java @@ -288,7 +288,36 @@ protected void checkInterfaceAndMethods(Class interfaceClass, List interfaceClass) { + void checkMock(Class interfaceClass) { + if (ConfigUtils.isEmpty(mock)) { + return; + } + + String normalizedMock = MockInvoker.normalizeMock(mock); + if (normalizedMock.startsWith(Constants.RETURN_PREFIX)) { + normalizedMock = normalizedMock.substring(Constants.RETURN_PREFIX.length()).trim(); + try { + MockInvoker.parseMockValue(normalizedMock); + } catch (Exception e) { + throw new IllegalStateException("Illegal mock return in "); + } + } else if (normalizedMock.startsWith(Constants.THROW_PREFIX)) { + normalizedMock = normalizedMock.substring(Constants.THROW_PREFIX.length()).trim(); + if (ConfigUtils.isNotEmpty(normalizedMock)) { + try { + MockInvoker.getThrowable(normalizedMock); + } catch (Exception e) { + throw new IllegalStateException("Illegal mock throw in "); + } + } + } else { + MockInvoker.getMockObject(normalizedMock, interfaceClass); + } + } + + void checkStub(Class interfaceClass) { if (ConfigUtils.isNotEmpty(local)) { Class localClass = ConfigUtils.isDefault(local) ? ReflectUtils.forName(interfaceClass.getName() + "Local") : ReflectUtils.forName(local); if (!interfaceClass.isAssignableFrom(localClass)) { @@ -311,26 +340,6 @@ protected void checkStubAndMock(Class interfaceClass) { throw new IllegalStateException("No such constructor \"public " + localClass.getSimpleName() + "(" + interfaceClass.getName() + ")\" in local implementation class " + localClass.getName()); } } - if (ConfigUtils.isNotEmpty(mock)) { - if (mock.startsWith(Constants.RETURN_PREFIX)) { - String value = mock.substring(Constants.RETURN_PREFIX.length()); - try { - MockInvoker.parseMockValue(value); - } catch (Exception e) { - throw new IllegalStateException("Illegal mock json value in "); - } - } else { - Class mockClass = ConfigUtils.isDefault(mock) ? ReflectUtils.forName(interfaceClass.getName() + "Mock") : ReflectUtils.forName(mock); - if (!interfaceClass.isAssignableFrom(mockClass)) { - throw new IllegalStateException("The mock implementation class " + mockClass.getName() + " not implement interface " + interfaceClass.getName()); - } - try { - mockClass.getConstructor(new Class[0]); - } catch (NoSuchMethodException e) { - throw new IllegalStateException("No such empty constructor \"public " + mockClass.getSimpleName() + "()\" in mock implementation class " + mockClass.getName()); - } - } - } } /** @@ -525,4 +534,4 @@ public void setScope(String scope) { this.scope = scope; } -} \ No newline at end of file +} diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java index 266c5db8676..92df4a1d3f7 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java @@ -127,8 +127,14 @@ public void setMock(Boolean mock) { } public void setMock(String mock) { - if (mock != null && mock.startsWith(Constants.RETURN_PREFIX)) { + if (mock == null) { + return; + } + + if (mock.startsWith(Constants.RETURN_PREFIX) || mock.startsWith(Constants.THROW_PREFIX + " ")) { checkLength("mock", mock); + } else if (mock.startsWith(Constants.FAIL_PREFIX) || mock.startsWith(Constants.FORCE_PREFIX)) { + checkNameHasSymbol("mock", mock); } else { checkName("mock", mock); } @@ -168,4 +174,4 @@ public void setParameters(Map parameters) { this.parameters = parameters; } -} \ No newline at end of file +} diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java index 5fe6c897210..c761d9c5d6c 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java @@ -276,7 +276,8 @@ private void init() { } } checkApplication(); - checkStubAndMock(interfaceClass); + checkStub(interfaceClass); + checkMock(interfaceClass); Map map = new HashMap(); Map attributes = new HashMap(); map.put(Constants.SIDE_KEY, Constants.CONSUMER_SIDE); diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java index 846b2165c40..8435db5d41a 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java @@ -310,7 +310,8 @@ protected synchronized void doExport() { checkRegistry(); checkProtocol(); appendProperties(this); - checkStubAndMock(interfaceClass); + checkStub(interfaceClass); + checkMock(interfaceClass); if (path == null || path.length() == 0) { path = interfaceName; } diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java index 765c429b8a3..2dc595fc597 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java @@ -198,7 +198,8 @@ public void checkName() throws Exception { @Test public void checkNameHasSymbol() throws Exception { try { - AbstractConfig.checkNameHasSymbol("hello", ":*,/-0123abcdABCD"); + AbstractConfig.checkNameHasSymbol("hello", ":*,/ -0123\tabcdABCD"); + AbstractConfig.checkNameHasSymbol("mock", "force:return world"); } catch (Exception e) { TestCase.fail("the value should be legal."); } diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractInterfaceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractInterfaceConfigTest.java index 4f08d29e972..7056c722346 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractInterfaceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractInterfaceConfigTest.java @@ -178,63 +178,72 @@ public void checkInterfaceAndMethod5() throws Exception { public void checkStubAndMock1() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setLocal(GreetingLocal1.class.getName()); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test(expected = IllegalStateException.class) public void checkStubAndMock2() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setLocal(GreetingLocal2.class.getName()); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test public void checkStubAndMock3() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setLocal(GreetingLocal3.class.getName()); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test(expected = IllegalStateException.class) public void checkStubAndMock4() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setStub(GreetingLocal1.class.getName()); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test(expected = IllegalStateException.class) public void checkStubAndMock5() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setStub(GreetingLocal2.class.getName()); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test public void checkStubAndMock6() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setStub(GreetingLocal3.class.getName()); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test(expected = IllegalStateException.class) public void checkStubAndMock7() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setMock("return {a, b}"); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test(expected = IllegalStateException.class) public void checkStubAndMock8() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setMock(GreetingMock1.class.getName()); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test(expected = IllegalStateException.class) public void checkStubAndMock9() throws Exception { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setMock(GreetingMock2.class.getName()); - interfaceConfig.checkStubAndMock(Greeting.class); + interfaceConfig.checkStub(Greeting.class); + interfaceConfig.checkMock(Greeting.class); } @Test diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/support/MockInvoker.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/support/MockInvoker.java index 7ee2b20016e..fc99bdcd1e3 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/support/MockInvoker.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/support/MockInvoker.java @@ -96,26 +96,21 @@ public Result invoke(Invocation invocation) throws RpcException { if (StringUtils.isBlank(mock)) { throw new RpcException(new IllegalAccessException("mock can not be null. url :" + url)); } - mock = normallizeMock(URL.decode(mock)); - if (Constants.RETURN_PREFIX.trim().equalsIgnoreCase(mock.trim())) { - RpcResult result = new RpcResult(); - result.setValue(null); - return result; - } else if (mock.startsWith(Constants.RETURN_PREFIX)) { + mock = normalizeMock(URL.decode(mock)); + if (mock.startsWith(Constants.RETURN_PREFIX)) { mock = mock.substring(Constants.RETURN_PREFIX.length()).trim(); - mock = mock.replace('`', '"'); try { Type[] returnTypes = RpcUtils.getReturnTypes(invocation); Object value = parseMockValue(mock, returnTypes); return new RpcResult(value); } catch (Exception ew) { - throw new RpcException("mock return invoke error. method :" + invocation.getMethodName() + ", mock:" + mock + ", url: " + url, ew); + throw new RpcException("mock return invoke error. method :" + invocation.getMethodName() + + ", mock:" + mock + ", url: " + url, ew); } } else if (mock.startsWith(Constants.THROW_PREFIX)) { mock = mock.substring(Constants.THROW_PREFIX.length()).trim(); - mock = mock.replace('`', '"'); if (StringUtils.isBlank(mock)) { - throw new RpcException(" mocked exception for Service degradation. "); + throw new RpcException("mocked exception for service degradation."); } else { // user customized class Throwable t = getThrowable(mock); throw new RpcException(RpcException.BIZ_EXCEPTION, t); @@ -125,29 +120,29 @@ public Result invoke(Invocation invocation) throws RpcException { Invoker invoker = getInvoker(mock); return invoker.invoke(invocation); } catch (Throwable t) { - throw new RpcException("Failed to create mock implemention class " + mock, t); + throw new RpcException("Failed to create mock implementation class " + mock, t); } } } - private Throwable getThrowable(String throwstr) { - Throwable throwable = (Throwable) throwables.get(throwstr); + public static Throwable getThrowable(String throwstr) { + Throwable throwable = throwables.get(throwstr); if (throwable != null) { return throwable; - } else { - Throwable t = null; - try { - Class bizException = ReflectUtils.forName(throwstr); - Constructor constructor; - constructor = ReflectUtils.findConstructor(bizException, String.class); - t = (Throwable) constructor.newInstance(new Object[]{" mocked exception for Service degradation. "}); - if (throwables.size() < 1000) { - throwables.put(throwstr, t); - } - } catch (Exception e) { - throw new RpcException("mock throw error :" + throwstr + " argument error.", e); + } + + try { + Throwable t; + Class bizException = ReflectUtils.forName(throwstr); + Constructor constructor; + constructor = ReflectUtils.findConstructor(bizException, String.class); + t = (Throwable) constructor.newInstance(new Object[]{"mocked exception for service degradation."}); + if (throwables.size() < 1000) { + throwables.put(throwstr, t); } return t; + } catch (Exception e) { + throw new RpcException("mock throw error :" + throwstr + " argument error.", e); } } @@ -156,49 +151,84 @@ private Invoker getInvoker(String mockService) { Invoker invoker = (Invoker) mocks.get(mockService); if (invoker != null) { return invoker; - } else { - Class serviceType = (Class) ReflectUtils.forName(url.getServiceInterface()); - if (ConfigUtils.isDefault(mockService)) { - mockService = serviceType.getName() + "Mock"; - } + } - Class mockClass = ReflectUtils.forName(mockService); - if (!serviceType.isAssignableFrom(mockClass)) { - throw new IllegalArgumentException("The mock implemention class " + mockClass.getName() + " not implement interface " + serviceType.getName()); - } + Class serviceType = (Class) ReflectUtils.forName(url.getServiceInterface()); + T mockObject = (T) getMockObject(mockService, serviceType); + invoker = proxyFactory.getInvoker(mockObject, serviceType, url); + if (mocks.size() < 10000) { + mocks.put(mockService, invoker); + } + return invoker; + } - if (!serviceType.isAssignableFrom(mockClass)) { - throw new IllegalArgumentException("The mock implemention class " + mockClass.getName() + " not implement interface " + serviceType.getName()); - } - try { - T mockObject = (T) mockClass.newInstance(); - invoker = proxyFactory.getInvoker(mockObject, (Class) serviceType, url); - if (mocks.size() < 10000) { - mocks.put(mockService, invoker); - } - return invoker; - } catch (InstantiationException e) { - throw new IllegalStateException("No such empty constructor \"public " + mockClass.getSimpleName() + "()\" in mock implemention class " + mockClass.getName(), e); - } catch (IllegalAccessException e) { - throw new IllegalStateException(e); - } + @SuppressWarnings("unchecked") + public static Object getMockObject(String mockService, Class serviceType) { + if (ConfigUtils.isDefault(mockService)) { + mockService = serviceType.getName() + "Mock"; + } + + Class mockClass = ReflectUtils.forName(mockService); + if (!serviceType.isAssignableFrom(mockClass)) { + throw new IllegalStateException("The mock class " + mockClass.getName() + + " not implement interface " + serviceType.getName()); + } + + try { + return mockClass.newInstance(); + } catch (InstantiationException e) { + throw new IllegalStateException("No default constructor from mock class " + mockClass.getName(), e); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); } } - //mock=fail:throw - //mock=fail:return - //mock=xx.Service - private String normallizeMock(String mock) { - if (mock == null || mock.trim().length() == 0) { + + /** + * Normalize mock string: + * + *
    + *
  1. return => return null
  2. + *
  3. fail => default
  4. + *
  5. force => default
  6. + *
  7. fail:throw/return foo => throw/return foo
  8. + *
  9. force:throw/return foo => throw/return foo
  10. + *
+ * + * @param mock mock string + * @return normalized mock string + */ + public static String normalizeMock(String mock) { + if (mock == null) { return mock; - } else if (ConfigUtils.isDefault(mock) || "fail".equalsIgnoreCase(mock.trim()) || "force".equalsIgnoreCase(mock.trim())) { - mock = url.getServiceInterface() + "Mock"; } + + mock = mock.trim(); + + if (mock.length() == 0) { + return mock; + } + + if (Constants.RETURN_KEY.equalsIgnoreCase(mock)) { + return Constants.RETURN_PREFIX + "null"; + } + + if (ConfigUtils.isDefault(mock) || "fail".equalsIgnoreCase(mock) || "force".equalsIgnoreCase(mock)) { + return "default"; + } + if (mock.startsWith(Constants.FAIL_PREFIX)) { mock = mock.substring(Constants.FAIL_PREFIX.length()).trim(); - } else if (mock.startsWith(Constants.FORCE_PREFIX)) { + } + + if (mock.startsWith(Constants.FORCE_PREFIX)) { mock = mock.substring(Constants.FORCE_PREFIX.length()).trim(); } + + if (mock.startsWith(Constants.RETURN_PREFIX) || mock.startsWith(Constants.THROW_PREFIX)) { + mock = mock.replace('`', '"'); + } + return mock; } From ef4ecdf3a36f1378895e611c44c330aba1284fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E6=97=A0=E4=B8=A4=E4=B8=B6?= <442367943@qq.com> Date: Wed, 7 Nov 2018 16:55:11 +0800 Subject: [PATCH 06/23] Add forks support for ForkingCluster. (#2751) Add forks support for ForkingCluster. --- .../alibaba/dubbo/config/AbstractMethodConfig.java | 13 +++++++++++++ .../dubbo/config/AbstractMethodConfigTest.java | 7 +++++++ .../src/main/resources/META-INF/compat/dubbo.xsd | 10 ++++++++++ .../src/main/resources/META-INF/dubbo.xsd | 10 ++++++++++ .../com/alibaba/dubbo/config/spring/ConfigTest.java | 13 +++++++++++++ 5 files changed, 53 insertions(+) diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java index 92df4a1d3f7..aa8b7ea3925 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java @@ -64,6 +64,19 @@ public abstract class AbstractMethodConfig extends AbstractConfig { // customized parameters protected Map parameters; + /** + * forks for forking cluster + */ + protected Integer forks; + + public Integer getForks() { + return forks; + } + + public void setForks(Integer forks) { + this.forks = forks; + } + public Integer getTimeout() { return timeout; } diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractMethodConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractMethodConfigTest.java index 2a1a890f670..d5463fe9a62 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractMethodConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractMethodConfigTest.java @@ -35,6 +35,13 @@ public void testTimeout() throws Exception { assertThat(methodConfig.getTimeout(), equalTo(10)); } + @Test + public void testForks() throws Exception { + MethodConfig methodConfig = new MethodConfig(); + methodConfig.setForks(10); + assertThat(methodConfig.getForks(), equalTo(10)); + } + @Test public void testRetries() throws Exception { MethodConfig methodConfig = new MethodConfig(); diff --git a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd index 2dbdde18e54..c48e2c3deab 100644 --- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd +++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd @@ -101,6 +101,11 @@ + + + + + @@ -480,6 +485,11 @@ + + + + + diff --git a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd index 0c17e24771f..40a7ac6c723 100644 --- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd +++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd @@ -101,6 +101,11 @@ + + + + + @@ -480,6 +485,11 @@ + + + + + diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java index 2415de4f8f7..69f716b25cc 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java @@ -148,6 +148,19 @@ public void testToString() { assertTrue(str.endsWith(" />")); } + @Test + public void testForks() { + ReferenceConfig reference = new ReferenceConfig(); + reference.setApplication(new ApplicationConfig("consumer")); + reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); + reference.setInterface(DemoService.class); + reference.setUrl("dubbo://127.0.0.1:20881"); + int forks = 10; + reference.setForks(forks); + String str = reference.toString(); + assertTrue(str.contains("forks=\"" + forks + "\"")); + } + @Test public void testMultiProtocol() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/multi-protocol.xml"); From d6aae075b1d285ead105ce3cc6d4fdcaaaf1c42e Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Wed, 7 Nov 2018 17:44:27 +0800 Subject: [PATCH 07/23] #2748: Provider should disable mock configuration (#2750) --- .../java/com/alibaba/dubbo/config/ServiceConfig.java | 10 ++++++++++ .../com/alibaba/dubbo/config/ServiceConfigTest.java | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java index 8435db5d41a..c02a222afe4 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java @@ -820,6 +820,16 @@ public void setGeneric(String generic) { } } + @Override + public void setMock(Boolean mock) { + throw new IllegalArgumentException("mock doesn't support on provider side"); + } + + @Override + public void setMock(String mock) { + throw new IllegalArgumentException("mock doesn't support on provider side"); + } + public List getExportedUrls() { return urls; } diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java index ed5a2e33d7f..2765b9fa18d 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java @@ -194,6 +194,18 @@ public void testGeneric2() throws Exception { service.setGeneric("illegal"); } + @Test(expected = IllegalArgumentException.class) + public void testMock() throws Exception { + ServiceConfig service = new ServiceConfig(); + service.setMock("true"); + } + + @Test(expected = IllegalArgumentException.class) + public void testMock2() throws Exception { + ServiceConfig service = new ServiceConfig(); + service.setMock(true); + } + @Test public void testUniqueServiceName() throws Exception { ServiceConfig service = new ServiceConfig(); From a1b27ab18c56d17284140d4806241d73eff56e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=B0=8F=E6=B3=A2?= Date: Thu, 8 Nov 2018 12:45:52 +0800 Subject: [PATCH 08/23] Fix the bug that ReferenceBean refers service more than once when debugging. (#2759) note: please visit http://t.cn/EAhta27 for more detail. --- .../src/main/java/com/alibaba/dubbo/config/AbstractConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java index 548205eb66c..1805e49370b 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java @@ -457,7 +457,8 @@ public String toString() { try { String name = method.getName(); if ((name.startsWith("get") || name.startsWith("is")) - && !"getClass".equals(name) && !"get".equals(name) && !"is".equals(name) + && !"get".equals(name) && !"is".equals(name) + && !"getClass".equals(name) && !"getObject".equals(name) && Modifier.isPublic(method.getModifiers()) && method.getParameterTypes().length == 0 && isPrimitive(method.getReturnType())) { From 86c473771adb859a361d369248b809c245898bf8 Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Thu, 8 Nov 2018 14:47:16 +0800 Subject: [PATCH 09/23] merge pull request #2353 to 2.6.x to fix #2353 (#2761) --- .../ServiceAnnotationBeanPostProcessor.java | 5 +++-- .../dubbo/config/spring/ConfigTest.java | 20 ++++++++++++++++++- .../annotation/provider/HelloServiceImpl.java | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java index 9ba4cc567cc..d34b4a60e7f 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java @@ -369,7 +369,8 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class MutablePropertyValues propertyValues = beanDefinition.getPropertyValues(); - String[] ignoreAttributeNames = of("provider", "monitor", "application", "module", "registry", "protocol", "interface"); + String[] ignoreAttributeNames = of("provider", "monitor", "application", "module", "registry", "protocol", + "interface", "interfaceName"); propertyValues.addPropertyValues(new AnnotationPropertyValuesAdapter(service, environment, ignoreAttributeNames)); @@ -483,4 +484,4 @@ public void setBeanClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } -} \ No newline at end of file +} diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java index 69f716b25cc..edaaa88a3bb 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java @@ -33,6 +33,7 @@ import com.alibaba.dubbo.config.spring.annotation.consumer.AnnotationAction; import com.alibaba.dubbo.config.spring.api.DemoService; import com.alibaba.dubbo.config.spring.api.HelloService; +import com.alibaba.dubbo.config.spring.context.annotation.provider.ProviderConfiguration; import com.alibaba.dubbo.config.spring.filter.MockFilter; import com.alibaba.dubbo.config.spring.impl.DemoServiceImpl; import com.alibaba.dubbo.config.spring.impl.HelloServiceImpl; @@ -51,6 +52,7 @@ import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.Collection; @@ -106,6 +108,22 @@ public void testServiceClass() { } } + @Test + public void testServiceAnnotation() { + AnnotationConfigApplicationContext providerContext = new AnnotationConfigApplicationContext(); + providerContext.register(ProviderConfiguration.class); + + providerContext.refresh(); + + ReferenceConfig reference = new ReferenceConfig(); + reference.setApplication(new ApplicationConfig("consumer")); + reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); + reference.setInterface(HelloService.class); + reference.setUrl("dubbo://127.0.0.1:12345"); + String hello = reference.get().sayHello("hello"); + assertEquals("Hello, hello", hello); + } + @Test @SuppressWarnings("unchecked") public void testProviderNestedService() { @@ -999,4 +1017,4 @@ public void testGenericServiceConfigThroughSpring() throws Exception { ctx.destroy(); } } -} \ No newline at end of file +} diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java index 9d0fdbb19b9..a9212f0ddc4 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java @@ -24,7 +24,7 @@ * * @since 2.5.9 */ -@Service +@Service(interfaceName = "com.alibaba.dubbo.config.spring.api.HelloService") public class HelloServiceImpl implements HelloService { @Override From 7629e7309096d7d5509ba683ec31590b9b8acecc Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Fri, 9 Nov 2018 18:41:20 +0800 Subject: [PATCH 10/23] #2762: [Dubbo - qos-http] stopServer should be invoked ? (#2768) --- .../dubbo/qos/protocol/QosProtocolWrapper.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java b/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java index 73d1f56a797..e7a8ff6bee6 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java @@ -74,13 +74,10 @@ public Invoker refer(Class type, URL url) throws RpcException { @Override public void destroy() { protocol.destroy(); + stopServer(); } private void startQosServer(URL url) { - if (!hasStarted.compareAndSet(false, true)) { - return; - } - try { boolean qosEnable = url.getParameter(QOS_ENABLE,true); if (!qosEnable) { @@ -90,6 +87,10 @@ private void startQosServer(URL url) { return; } + if (!hasStarted.compareAndSet(false, true)) { + return; + } + int port = url.getParameter(QOS_PORT, DEFAULT_PORT); boolean acceptForeignIp = Boolean.parseBoolean(url.getParameter(ACCEPT_FOREIGN_IP,"false")); Server server = com.alibaba.dubbo.qos.server.Server.getInstance(); @@ -101,4 +102,11 @@ private void startQosServer(URL url) { logger.warn("Fail to start qos server: ", throwable); } } + + /*package*/ void stopServer() { + if (hasStarted.compareAndSet(true, false)) { + Server server = Server.getInstance(); + server.stop(); + } + } } From 9cc4f933a28a0c75ede2cd20bb1161fc431fa8e6 Mon Sep 17 00:00:00 2001 From: cvictory Date: Mon, 12 Nov 2018 11:20:56 +0800 Subject: [PATCH 11/23] 2.6.5 release note change (#2775) * release 2.6.5 * edit release note for 2.6.5 (rewrite log) * mmm * edit release note to remove some unuseful word * merge from upstream and origin --- CHANGES.md | 6 +++--- .../main/java/com/alibaba/dubbo/demo/consumer/Consumer.java | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a9b1e20cdaf..e95ea44fca5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,8 +6,8 @@ Enhancements / Features: - Reactor the generation rule for @Service Bean name [#2235](https://github.com/apache/incubator-dubbo/issues/2235) - Introduce a new Spring ApplicationEvent for ServiceBean exporting [#2251](https://github.com/apache/incubator-dubbo/issues/2251) -- [Enhancement] the algorithm of load issue on Windows good first issue help wanted. [#1641](https://github.com/apache/incubator-dubbo/issues/1641) -- add javadoc to dubbo-all module good first issue help wanted. [#2600](https://github.com/apache/incubator-dubbo/issues/2600) +- [Enhancement] the algorithm of load issue on Windows. [#1641](https://github.com/apache/incubator-dubbo/issues/1641) +- add javadoc to dubbo-all module good first issue. [#2600](https://github.com/apache/incubator-dubbo/issues/2600) - [Enhancement] Reactor the generation rule for @Service Bean name type/enhancement [#2235](https://github.com/apache/incubator-dubbo/issues/2235) - Optimize LeastActiveLoadBalance and add weight test case. [#2540](https://github.com/apache/incubator-dubbo/issues/2540) - Smooth Round Robin selection. [#2578](https://github.com/apache/incubator-dubbo/issues/2578) [#2647](https://github.com/apache/incubator-dubbo/pull/2647) @@ -114,4 +114,4 @@ Issues and Pull Requests, check [milestone-2.6.3](https://github.com/apache/incu - Waiting for registry notification on consumer side by checking channel state. 7. Simplify consumer/provider side check in RpcContext, #1444. -Issues and Pull Requests, check [milestone-2.6.2](https://github.com/apache/incubator-dubbo/milestone/15). \ No newline at end of file +Issues and Pull Requests, check [milestone-2.6.2](https://github.com/apache/incubator-dubbo/milestone/15). diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/Consumer.java b/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/Consumer.java index 9caacbc7ad7..66f72e86f36 100644 --- a/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/Consumer.java +++ b/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/Consumer.java @@ -38,8 +38,6 @@ public static void main(String[] args) { } catch (Throwable throwable) { throwable.printStackTrace(); } - - } } From faa0abf7c2607115be3ca140f51ede0e71a5b3f1 Mon Sep 17 00:00:00 2001 From: "ken.lj" Date: Thu, 1 Nov 2018 22:51:48 +0800 Subject: [PATCH 12/23] [Dubbo-2678] Add ability to turn off SPI auto injection, special support for Object type. (#2681) * Add ability to turn off SPI auto injection, special support for generic Object type injection. * Add ability to turn off SPI auto injection, special support for generic Object type injection. * disable() is redundant in DisableInject annotation. --- .../dubbo/common/extension/DisableInject.java | 29 +++++++++ .../common/extension/ExtensionLoader.java | 6 ++ .../extensionloader/ExtensionLoaderTest.java | 12 ++++ .../extensionloader/injection/InjectExt.java | 27 ++++++++ .../injection/impl/InjectExtImpl.java | 61 +++++++++++++++++++ ...common.extensionloader.injection.InjectExt | 1 + .../extension/SpringExtensionFactory.java | 10 ++- 7 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/DisableInject.java create mode 100644 dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/injection/InjectExt.java create mode 100644 dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/injection/impl/InjectExtImpl.java create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/com.alibaba.dubbo.common.extensionloader.injection.InjectExt diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/DisableInject.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/DisableInject.java new file mode 100644 index 00000000000..3f83834ca7f --- /dev/null +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/DisableInject.java @@ -0,0 +1,29 @@ +/* + * 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 com.alibaba.dubbo.common.extension; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.METHOD}) +public @interface DisableInject { +} diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java index 7509a3d56db..94c59bb7f05 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java @@ -515,6 +515,12 @@ private T injectExtension(T instance) { if (method.getName().startsWith("set") && method.getParameterTypes().length == 1 && Modifier.isPublic(method.getModifiers())) { + /** + * Check {@link DisableInject} to see if we need auto injection for this property + */ + if (method.getAnnotation(DisableInject.class) != null) { + continue; + } Class pt = method.getParameterTypes()[0]; try { String property = method.getName().length() > 3 ? method.getName().substring(3, 4).toLowerCase() + method.getName().substring(4) : ""; diff --git a/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/ExtensionLoaderTest.java b/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/ExtensionLoaderTest.java index 3f7900c38b6..e6ef0281b7f 100644 --- a/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/ExtensionLoaderTest.java +++ b/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/ExtensionLoaderTest.java @@ -46,6 +46,8 @@ import com.alibaba.dubbo.common.extensionloader.ext8_add.impl.AddExt4_ManualAdaptive; import com.alibaba.dubbo.common.extensionloader.ext9_empty.Ext9Empty; import com.alibaba.dubbo.common.extensionloader.ext9_empty.impl.Ext9EmptyImpl; +import com.alibaba.dubbo.common.extensionloader.injection.InjectExt; +import com.alibaba.dubbo.common.extensionloader.injection.impl.InjectExtImpl; import junit.framework.Assert; import org.junit.Test; @@ -416,4 +418,14 @@ public void testLoadDefaultActivateExtension() throws Exception { Assert.assertTrue(list.get(1).getClass() == OrderActivateExtImpl1.class); } + @Test + public void testInjectExtension() { + // test default + InjectExt injectExt = ExtensionLoader.getExtensionLoader(InjectExt.class).getExtension("injection"); + InjectExtImpl injectExtImpl = (InjectExtImpl) injectExt; + org.junit.Assert.assertNotNull(injectExtImpl.getSimpleExt()); + org.junit.Assert.assertNull(injectExtImpl.getSimpleExt1()); + org.junit.Assert.assertNull(injectExtImpl.getGenericType()); + } + } \ No newline at end of file diff --git a/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/injection/InjectExt.java b/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/injection/InjectExt.java new file mode 100644 index 00000000000..a9d48dd6e59 --- /dev/null +++ b/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/injection/InjectExt.java @@ -0,0 +1,27 @@ +/* + * 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 com.alibaba.dubbo.common.extensionloader.injection; + +import com.alibaba.dubbo.common.extension.SPI; + +/** + * + */ +@SPI("injection") +public interface InjectExt { + String echo(String msg); +} diff --git a/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/injection/impl/InjectExtImpl.java b/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/injection/impl/InjectExtImpl.java new file mode 100644 index 00000000000..c2965931345 --- /dev/null +++ b/dubbo-common/src/test/java/com/alibaba/dubbo/common/extensionloader/injection/impl/InjectExtImpl.java @@ -0,0 +1,61 @@ +/* + * 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 com.alibaba.dubbo.common.extensionloader.injection.impl; + + +import com.alibaba.dubbo.common.extension.DisableInject; +import com.alibaba.dubbo.common.extensionloader.ext1.SimpleExt; +import com.alibaba.dubbo.common.extensionloader.injection.InjectExt; + +public class InjectExtImpl implements InjectExt { + + private SimpleExt simpleExt; + + private SimpleExt simpleExt1; + + private Object genericType; + + public void setSimpleExt(SimpleExt simpleExt) { + this.simpleExt = simpleExt; + } + + @DisableInject + public void setSimpleExt1(SimpleExt simpleExt1) { + this.simpleExt1 = simpleExt1; + } + + public void setGenericType(Object genericType) { + this.genericType = genericType; + } + + @Override + public String echo(String msg) { + return null; + } + + public SimpleExt getSimpleExt() { + return simpleExt; + } + + public SimpleExt getSimpleExt1() { + return simpleExt1; + } + + public Object getGenericType() { + return genericType; + } +} diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/com.alibaba.dubbo.common.extensionloader.injection.InjectExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/com.alibaba.dubbo.common.extensionloader.injection.InjectExt new file mode 100644 index 00000000000..687d18d5380 --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/com.alibaba.dubbo.common.extensionloader.injection.InjectExt @@ -0,0 +1 @@ +injection=com.alibaba.dubbo.common.extensionloader.injection.impl.InjectExtImpl \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java index 389515d1f1d..8673b3925fd 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java @@ -60,13 +60,17 @@ public T getExtension(Class type, String name) { } } - logger.warn("No spring extension(bean) named:" + name + ", try to find an extension(bean) of type " + type.getName()); + logger.warn("No spring extension (bean) named:" + name + ", try to find an extension (bean) of type " + type.getName()); + + if (Object.class == type) { + return null; + } for (ApplicationContext context : contexts) { try { return context.getBean(type); } catch (NoUniqueBeanDefinitionException multiBeanExe) { - throw multiBeanExe; + logger.warn("Find more than 1 spring extensions (beans) of type " + type.getName() + ", will stop auto injection. Please make sure you have specified the concrete parameter type and there's only one extension of that type."); } catch (NoSuchBeanDefinitionException noBeanExe) { if (logger.isDebugEnabled()) { logger.debug("Error when get spring extension(bean) for type:" + type.getName(), noBeanExe); @@ -74,7 +78,7 @@ public T getExtension(Class type, String name) { } } - logger.warn("No spring extension(bean) named:" + name + ", type:" + type.getName() + " found, stop get bean."); + logger.warn("No spring extension (bean) named:" + name + ", type:" + type.getName() + " found, stop get bean."); return null; } From c290991cb5dc02e1cdb0e36b11f92af1ba093e71 Mon Sep 17 00:00:00 2001 From: "ken.lj" Date: Tue, 13 Nov 2018 16:07:32 +0800 Subject: [PATCH 13/23] Update release note --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index e95ea44fca5..9bb673a9c6d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ Enhancements / Features: - Optimize LeastActiveLoadBalance and add weight test case. [#2540](https://github.com/apache/incubator-dubbo/issues/2540) - Smooth Round Robin selection. [#2578](https://github.com/apache/incubator-dubbo/issues/2578) [#2647](https://github.com/apache/incubator-dubbo/pull/2647) - [Enhancement] Resolve the placeholders for sub-properties. [#2297](https://github.com/apache/incubator-dubbo/issues/2297) +- Add ability to turn off SPI auto injection, special support for generic Object type injection. [#2681](https://github.com/apache/incubator-dubbo/pull/2681) Bugfixes: From 7b1985a1a671c9f43f2972ac2bf76066badf641c Mon Sep 17 00:00:00 2001 From: cvictory Date: Tue, 13 Nov 2018 16:13:20 +0800 Subject: [PATCH 14/23] fix #2459 sha512 issue --- release.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index d5e94019796..187c8191eaf 100755 --- a/release.sh +++ b/release.sh @@ -150,8 +150,8 @@ git reset --hard $COMMIT_ID cd distribution/target echo "Start to shasum for bin/source.zip" -shasum -a 512 apache-dubbo-incubating-${VERSION}-source-release.zip >> apache-dubbo-incubating-${VERSION}-source-release.zip.sha512 -shasum -a 512 apache-dubbo-incubating-${VERSION}-bin-release.zip >> apache-dubbo-incubating-${VERSION}-bin-release.zip.sha512 +shasum -b -a 512 apache-dubbo-incubating-${VERSION}-source-release.zip >> apache-dubbo-incubating-${VERSION}-source-release.zip.sha512 +shasum -b -a 512 apache-dubbo-incubating-${VERSION}-bin-release.zip >> apache-dubbo-incubating-${VERSION}-bin-release.zip.sha512 read -p "Need to push bin/source.zip to Apache svn repo ? (y/n, default is n) " NEED_PUSH_APACHE @@ -170,4 +170,4 @@ if [ "$NEED_PUSH_APACHE" = "y" ]; then echo "If this is your first release, make sure adding PUBLIC_KEY to KEYS manually." else echo "Skip push bin/source.zip to Apache svn repo" -fi \ No newline at end of file +fi From 38e0f15be33a5edb35b45d2c5d7c6be753bdd888 Mon Sep 17 00:00:00 2001 From: cvictory Date: Tue, 13 Nov 2018 18:51:19 +0800 Subject: [PATCH 15/23] [maven-release-plugin] prepare release dubbo-2.6.5 --- all/pom.xml | 4 ++-- bom/pom.xml | 4 ++-- dependencies-bom/pom.xml | 7 +++---- distribution/pom.xml | 2 +- dubbo-bootstrap/pom.xml | 2 +- dubbo-cluster/pom.xml | 2 +- dubbo-common/pom.xml | 2 +- dubbo-config/dubbo-config-api/pom.xml | 2 +- dubbo-config/dubbo-config-spring/pom.xml | 5 ++--- dubbo-config/pom.xml | 2 +- dubbo-container/dubbo-container-api/pom.xml | 2 +- dubbo-container/dubbo-container-log4j/pom.xml | 2 +- dubbo-container/dubbo-container-logback/pom.xml | 2 +- dubbo-container/dubbo-container-spring/pom.xml | 2 +- dubbo-container/pom.xml | 2 +- dubbo-demo/dubbo-demo-api/pom.xml | 2 +- dubbo-demo/dubbo-demo-consumer/pom.xml | 2 +- dubbo-demo/dubbo-demo-provider/pom.xml | 2 +- dubbo-demo/pom.xml | 2 +- dubbo-filter/dubbo-filter-cache/pom.xml | 2 +- dubbo-filter/dubbo-filter-validation/pom.xml | 2 +- dubbo-filter/pom.xml | 2 +- dubbo-monitor/dubbo-monitor-api/pom.xml | 2 +- dubbo-monitor/dubbo-monitor-default/pom.xml | 2 +- dubbo-monitor/pom.xml | 2 +- dubbo-plugin/dubbo-qos/pom.xml | 2 +- dubbo-plugin/pom.xml | 2 +- dubbo-registry/dubbo-registry-api/pom.xml | 2 +- dubbo-registry/dubbo-registry-default/pom.xml | 2 +- dubbo-registry/dubbo-registry-multicast/pom.xml | 2 +- dubbo-registry/dubbo-registry-redis/pom.xml | 2 +- dubbo-registry/dubbo-registry-zookeeper/pom.xml | 2 +- dubbo-registry/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-api/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-grizzly/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-http/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-mina/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-netty/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-netty4/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-p2p/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-zookeeper/pom.xml | 2 +- dubbo-remoting/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-api/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-dubbo/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-hessian/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-http/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-injvm/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-memcached/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-redis/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-rest/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-rmi/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-thrift/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-webservice/pom.xml | 2 +- dubbo-rpc/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-api/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-fastjson/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-fst/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-hessian2/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-jdk/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-kryo/pom.xml | 2 +- dubbo-serialization/pom.xml | 2 +- dubbo-test/dubbo-test-benchmark/pom.xml | 2 +- .../dubbo-test-compatibility/dubbo-test-spring3/pom.xml | 2 +- dubbo-test/dubbo-test-compatibility/pom.xml | 2 +- dubbo-test/dubbo-test-examples/pom.xml | 2 +- dubbo-test/dubbo-test-integration/pom.xml | 2 +- dubbo-test/pom.xml | 4 ++-- pom.xml | 6 +++--- 68 files changed, 76 insertions(+), 78 deletions(-) diff --git a/all/pom.xml b/all/pom.xml index 39884493871..eca7fed772f 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -19,11 +19,11 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 ../pom.xml dubbo - 2.6.5-SNAPSHOT + 2.6.5 jar dubbo-all The all in one project of dubbo diff --git a/bom/pom.xml b/bom/pom.xml index 165964f6e29..7083d6a1cc3 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -14,7 +14,7 @@ com.alibaba dubbo-bom - 2.6.5-SNAPSHOT + 2.6.5 pom dubbo-bom @@ -33,7 +33,7 @@ https://github.com/apache/incubator-dubbo scm:git:https://github.com/apache/incubator-dubbo.git scm:git:https://github.com/apache/incubator-dubbo.git - HEAD + dubbo-2.6.5 diff --git a/dependencies-bom/pom.xml b/dependencies-bom/pom.xml index 8da6b978125..46519ee9cca 100644 --- a/dependencies-bom/pom.xml +++ b/dependencies-bom/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 @@ -11,7 +10,7 @@ com.alibaba dubbo-dependencies-bom - 2.6.5-SNAPSHOT + 2.6.5 pom dubbo-dependencies-bom @@ -30,7 +29,7 @@ https://github.com/apache/incubator-dubbo scm:git:https://github.com/apache/incubator-dubbo.git scm:git:https://github.com/apache/incubator-dubbo.git - HEAD + dubbo-2.6.5 diff --git a/distribution/pom.xml b/distribution/pom.xml index ffdd3cffc25..2f584f24769 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-distribution pom diff --git a/dubbo-bootstrap/pom.xml b/dubbo-bootstrap/pom.xml index ae6440a5bce..c85ecf51fe7 100644 --- a/dubbo-bootstrap/pom.xml +++ b/dubbo-bootstrap/pom.xml @@ -18,7 +18,7 @@ dubbo-parent com.alibaba - 2.6.5-SNAPSHOT + 2.6.5 4.0.0 diff --git a/dubbo-cluster/pom.xml b/dubbo-cluster/pom.xml index d125ec35f56..e8276a8a6e6 100644 --- a/dubbo-cluster/pom.xml +++ b/dubbo-cluster/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-cluster jar diff --git a/dubbo-common/pom.xml b/dubbo-common/pom.xml index 742daa91793..d40c1f2a794 100644 --- a/dubbo-common/pom.xml +++ b/dubbo-common/pom.xml @@ -20,7 +20,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-common jar diff --git a/dubbo-config/dubbo-config-api/pom.xml b/dubbo-config/dubbo-config-api/pom.xml index 6403df283b7..4e86288c8e8 100644 --- a/dubbo-config/dubbo-config-api/pom.xml +++ b/dubbo-config/dubbo-config-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-config - 2.6.5-SNAPSHOT + 2.6.5 dubbo-config-api jar diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml index 7697f6fc934..1c8c847e253 100644 --- a/dubbo-config/dubbo-config-spring/pom.xml +++ b/dubbo-config/dubbo-config-spring/pom.xml @@ -14,13 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 com.alibaba dubbo-config - 2.6.5-SNAPSHOT + 2.6.5 dubbo-config-spring jar diff --git a/dubbo-config/pom.xml b/dubbo-config/pom.xml index 85e5cd70037..66f3f80034b 100644 --- a/dubbo-config/pom.xml +++ b/dubbo-config/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-config pom diff --git a/dubbo-container/dubbo-container-api/pom.xml b/dubbo-container/dubbo-container-api/pom.xml index b0169610d87..40b42f0e794 100644 --- a/dubbo-container/dubbo-container-api/pom.xml +++ b/dubbo-container/dubbo-container-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-container - 2.6.5-SNAPSHOT + 2.6.5 dubbo-container-api jar diff --git a/dubbo-container/dubbo-container-log4j/pom.xml b/dubbo-container/dubbo-container-log4j/pom.xml index c1fc490289f..e572024f2cf 100644 --- a/dubbo-container/dubbo-container-log4j/pom.xml +++ b/dubbo-container/dubbo-container-log4j/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-container - 2.6.5-SNAPSHOT + 2.6.5 dubbo-container-log4j jar diff --git a/dubbo-container/dubbo-container-logback/pom.xml b/dubbo-container/dubbo-container-logback/pom.xml index ff955274981..28bdcd3f93b 100644 --- a/dubbo-container/dubbo-container-logback/pom.xml +++ b/dubbo-container/dubbo-container-logback/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-container - 2.6.5-SNAPSHOT + 2.6.5 dubbo-container-logback jar diff --git a/dubbo-container/dubbo-container-spring/pom.xml b/dubbo-container/dubbo-container-spring/pom.xml index 0af93dcbf45..d1f777e01bc 100644 --- a/dubbo-container/dubbo-container-spring/pom.xml +++ b/dubbo-container/dubbo-container-spring/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-container - 2.6.5-SNAPSHOT + 2.6.5 dubbo-container-spring jar diff --git a/dubbo-container/pom.xml b/dubbo-container/pom.xml index a12f88ab480..e4d7c7b016e 100644 --- a/dubbo-container/pom.xml +++ b/dubbo-container/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-container pom diff --git a/dubbo-demo/dubbo-demo-api/pom.xml b/dubbo-demo/dubbo-demo-api/pom.xml index 14a10b185f4..d85884be3d6 100644 --- a/dubbo-demo/dubbo-demo-api/pom.xml +++ b/dubbo-demo/dubbo-demo-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-demo - 2.6.5-SNAPSHOT + 2.6.5 dubbo-demo-api jar diff --git a/dubbo-demo/dubbo-demo-consumer/pom.xml b/dubbo-demo/dubbo-demo-consumer/pom.xml index d10969dbccd..d208a61faa3 100644 --- a/dubbo-demo/dubbo-demo-consumer/pom.xml +++ b/dubbo-demo/dubbo-demo-consumer/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-demo - 2.6.5-SNAPSHOT + 2.6.5 dubbo-demo-consumer jar diff --git a/dubbo-demo/dubbo-demo-provider/pom.xml b/dubbo-demo/dubbo-demo-provider/pom.xml index acdae783b89..49ac84955e7 100644 --- a/dubbo-demo/dubbo-demo-provider/pom.xml +++ b/dubbo-demo/dubbo-demo-provider/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-demo - 2.6.5-SNAPSHOT + 2.6.5 dubbo-demo-provider jar diff --git a/dubbo-demo/pom.xml b/dubbo-demo/pom.xml index d64b9cefa6b..3798be05bf1 100644 --- a/dubbo-demo/pom.xml +++ b/dubbo-demo/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-demo pom diff --git a/dubbo-filter/dubbo-filter-cache/pom.xml b/dubbo-filter/dubbo-filter-cache/pom.xml index aeb65003c95..1d09d45bf37 100644 --- a/dubbo-filter/dubbo-filter-cache/pom.xml +++ b/dubbo-filter/dubbo-filter-cache/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-filter - 2.6.5-SNAPSHOT + 2.6.5 dubbo-filter-cache jar diff --git a/dubbo-filter/dubbo-filter-validation/pom.xml b/dubbo-filter/dubbo-filter-validation/pom.xml index 31185c8413c..1010109a772 100644 --- a/dubbo-filter/dubbo-filter-validation/pom.xml +++ b/dubbo-filter/dubbo-filter-validation/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-filter - 2.6.5-SNAPSHOT + 2.6.5 dubbo-filter-validation jar diff --git a/dubbo-filter/pom.xml b/dubbo-filter/pom.xml index 86ce451dab8..060661855f0 100644 --- a/dubbo-filter/pom.xml +++ b/dubbo-filter/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-filter pom diff --git a/dubbo-monitor/dubbo-monitor-api/pom.xml b/dubbo-monitor/dubbo-monitor-api/pom.xml index 76531eb5602..fa34909d4f1 100644 --- a/dubbo-monitor/dubbo-monitor-api/pom.xml +++ b/dubbo-monitor/dubbo-monitor-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-monitor - 2.6.5-SNAPSHOT + 2.6.5 dubbo-monitor-api jar diff --git a/dubbo-monitor/dubbo-monitor-default/pom.xml b/dubbo-monitor/dubbo-monitor-default/pom.xml index 9116062e130..43ed6efe012 100644 --- a/dubbo-monitor/dubbo-monitor-default/pom.xml +++ b/dubbo-monitor/dubbo-monitor-default/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-monitor - 2.6.5-SNAPSHOT + 2.6.5 dubbo-monitor-default jar diff --git a/dubbo-monitor/pom.xml b/dubbo-monitor/pom.xml index 4970ad27ff0..15e80d3627a 100644 --- a/dubbo-monitor/pom.xml +++ b/dubbo-monitor/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-monitor pom diff --git a/dubbo-plugin/dubbo-qos/pom.xml b/dubbo-plugin/dubbo-qos/pom.xml index bb494121176..d77fb9cceba 100644 --- a/dubbo-plugin/dubbo-qos/pom.xml +++ b/dubbo-plugin/dubbo-qos/pom.xml @@ -18,7 +18,7 @@ com.alibaba dubbo-plugin - 2.6.5-SNAPSHOT + 2.6.5 4.0.0 diff --git a/dubbo-plugin/pom.xml b/dubbo-plugin/pom.xml index a3ebbcb48cf..ef790530dc7 100644 --- a/dubbo-plugin/pom.xml +++ b/dubbo-plugin/pom.xml @@ -18,7 +18,7 @@ dubbo-parent com.alibaba - 2.6.5-SNAPSHOT + 2.6.5 4.0.0 diff --git a/dubbo-registry/dubbo-registry-api/pom.xml b/dubbo-registry/dubbo-registry-api/pom.xml index 1bc1de39053..4361a22e4a6 100644 --- a/dubbo-registry/dubbo-registry-api/pom.xml +++ b/dubbo-registry/dubbo-registry-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-registry - 2.6.5-SNAPSHOT + 2.6.5 dubbo-registry-api jar diff --git a/dubbo-registry/dubbo-registry-default/pom.xml b/dubbo-registry/dubbo-registry-default/pom.xml index 0aa33f1f5aa..de4b1a0a75d 100644 --- a/dubbo-registry/dubbo-registry-default/pom.xml +++ b/dubbo-registry/dubbo-registry-default/pom.xml @@ -20,7 +20,7 @@ com.alibaba dubbo-registry - 2.6.5-SNAPSHOT + 2.6.5 dubbo-registry-default jar diff --git a/dubbo-registry/dubbo-registry-multicast/pom.xml b/dubbo-registry/dubbo-registry-multicast/pom.xml index 15e2e31aa1f..6826a3e1b6f 100644 --- a/dubbo-registry/dubbo-registry-multicast/pom.xml +++ b/dubbo-registry/dubbo-registry-multicast/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-registry - 2.6.5-SNAPSHOT + 2.6.5 dubbo-registry-multicast jar diff --git a/dubbo-registry/dubbo-registry-redis/pom.xml b/dubbo-registry/dubbo-registry-redis/pom.xml index e677972d85c..8f9328c3fb6 100644 --- a/dubbo-registry/dubbo-registry-redis/pom.xml +++ b/dubbo-registry/dubbo-registry-redis/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-registry - 2.6.5-SNAPSHOT + 2.6.5 dubbo-registry-redis jar diff --git a/dubbo-registry/dubbo-registry-zookeeper/pom.xml b/dubbo-registry/dubbo-registry-zookeeper/pom.xml index e812448d98c..ffc50ad2019 100644 --- a/dubbo-registry/dubbo-registry-zookeeper/pom.xml +++ b/dubbo-registry/dubbo-registry-zookeeper/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-registry - 2.6.5-SNAPSHOT + 2.6.5 dubbo-registry-zookeeper jar diff --git a/dubbo-registry/pom.xml b/dubbo-registry/pom.xml index c2ef9d5769d..224eff6d2d8 100644 --- a/dubbo-registry/pom.xml +++ b/dubbo-registry/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-registry pom diff --git a/dubbo-remoting/dubbo-remoting-api/pom.xml b/dubbo-remoting/dubbo-remoting-api/pom.xml index 1314e443e1e..204af112493 100644 --- a/dubbo-remoting/dubbo-remoting-api/pom.xml +++ b/dubbo-remoting/dubbo-remoting-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5-SNAPSHOT + 2.6.5 dubbo-remoting-api jar diff --git a/dubbo-remoting/dubbo-remoting-grizzly/pom.xml b/dubbo-remoting/dubbo-remoting-grizzly/pom.xml index 96bf6832817..77513cd54ff 100644 --- a/dubbo-remoting/dubbo-remoting-grizzly/pom.xml +++ b/dubbo-remoting/dubbo-remoting-grizzly/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5-SNAPSHOT + 2.6.5 dubbo-remoting-grizzly jar diff --git a/dubbo-remoting/dubbo-remoting-http/pom.xml b/dubbo-remoting/dubbo-remoting-http/pom.xml index b0aee41e26b..f5236059304 100644 --- a/dubbo-remoting/dubbo-remoting-http/pom.xml +++ b/dubbo-remoting/dubbo-remoting-http/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5-SNAPSHOT + 2.6.5 dubbo-remoting-http jar diff --git a/dubbo-remoting/dubbo-remoting-mina/pom.xml b/dubbo-remoting/dubbo-remoting-mina/pom.xml index aea18f080bb..9bbc7f1ab3a 100644 --- a/dubbo-remoting/dubbo-remoting-mina/pom.xml +++ b/dubbo-remoting/dubbo-remoting-mina/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5-SNAPSHOT + 2.6.5 dubbo-remoting-mina jar diff --git a/dubbo-remoting/dubbo-remoting-netty/pom.xml b/dubbo-remoting/dubbo-remoting-netty/pom.xml index 78e90565a96..7a8bc0f4cd2 100644 --- a/dubbo-remoting/dubbo-remoting-netty/pom.xml +++ b/dubbo-remoting/dubbo-remoting-netty/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5-SNAPSHOT + 2.6.5 dubbo-remoting-netty jar diff --git a/dubbo-remoting/dubbo-remoting-netty4/pom.xml b/dubbo-remoting/dubbo-remoting-netty4/pom.xml index 35c7d7eb6ed..7fb00ce4e52 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/pom.xml +++ b/dubbo-remoting/dubbo-remoting-netty4/pom.xml @@ -18,7 +18,7 @@ dubbo-remoting com.alibaba - 2.6.5-SNAPSHOT + 2.6.5 4.0.0 diff --git a/dubbo-remoting/dubbo-remoting-p2p/pom.xml b/dubbo-remoting/dubbo-remoting-p2p/pom.xml index b00bd97f489..77c2a7da9a1 100644 --- a/dubbo-remoting/dubbo-remoting-p2p/pom.xml +++ b/dubbo-remoting/dubbo-remoting-p2p/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5-SNAPSHOT + 2.6.5 dubbo-remoting-p2p jar diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml index cd518ac47b0..ff7ee1ea9e1 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml +++ b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5-SNAPSHOT + 2.6.5 dubbo-remoting-zookeeper jar diff --git a/dubbo-remoting/pom.xml b/dubbo-remoting/pom.xml index 98affc30e4e..14bfa482b7b 100644 --- a/dubbo-remoting/pom.xml +++ b/dubbo-remoting/pom.xml @@ -20,7 +20,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-remoting pom diff --git a/dubbo-rpc/dubbo-rpc-api/pom.xml b/dubbo-rpc/dubbo-rpc-api/pom.xml index ede6069d473..f7368213f95 100644 --- a/dubbo-rpc/dubbo-rpc-api/pom.xml +++ b/dubbo-rpc/dubbo-rpc-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-api jar diff --git a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml index 332e9811c37..d659552d314 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml +++ b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-dubbo jar diff --git a/dubbo-rpc/dubbo-rpc-hessian/pom.xml b/dubbo-rpc/dubbo-rpc-hessian/pom.xml index ed66a81bef1..bc9c6acc700 100644 --- a/dubbo-rpc/dubbo-rpc-hessian/pom.xml +++ b/dubbo-rpc/dubbo-rpc-hessian/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-hessian jar diff --git a/dubbo-rpc/dubbo-rpc-http/pom.xml b/dubbo-rpc/dubbo-rpc-http/pom.xml index a7bf58b1e75..b03cb6c49d0 100644 --- a/dubbo-rpc/dubbo-rpc-http/pom.xml +++ b/dubbo-rpc/dubbo-rpc-http/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-http jar diff --git a/dubbo-rpc/dubbo-rpc-injvm/pom.xml b/dubbo-rpc/dubbo-rpc-injvm/pom.xml index 00a603e2c97..3e2dad53aa9 100644 --- a/dubbo-rpc/dubbo-rpc-injvm/pom.xml +++ b/dubbo-rpc/dubbo-rpc-injvm/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-injvm jar diff --git a/dubbo-rpc/dubbo-rpc-memcached/pom.xml b/dubbo-rpc/dubbo-rpc-memcached/pom.xml index ed73b7c43d7..a035da0ab7f 100644 --- a/dubbo-rpc/dubbo-rpc-memcached/pom.xml +++ b/dubbo-rpc/dubbo-rpc-memcached/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-memcached jar diff --git a/dubbo-rpc/dubbo-rpc-redis/pom.xml b/dubbo-rpc/dubbo-rpc-redis/pom.xml index ce7e06346c1..783097e629a 100644 --- a/dubbo-rpc/dubbo-rpc-redis/pom.xml +++ b/dubbo-rpc/dubbo-rpc-redis/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-redis jar diff --git a/dubbo-rpc/dubbo-rpc-rest/pom.xml b/dubbo-rpc/dubbo-rpc-rest/pom.xml index 5454db7aeca..c978f796256 100644 --- a/dubbo-rpc/dubbo-rpc-rest/pom.xml +++ b/dubbo-rpc/dubbo-rpc-rest/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-rest jar diff --git a/dubbo-rpc/dubbo-rpc-rmi/pom.xml b/dubbo-rpc/dubbo-rpc-rmi/pom.xml index e50d7b4ba5b..0f580c63511 100644 --- a/dubbo-rpc/dubbo-rpc-rmi/pom.xml +++ b/dubbo-rpc/dubbo-rpc-rmi/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-rmi jar diff --git a/dubbo-rpc/dubbo-rpc-thrift/pom.xml b/dubbo-rpc/dubbo-rpc-thrift/pom.xml index 77d808aece2..3f07c82d9cb 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/pom.xml +++ b/dubbo-rpc/dubbo-rpc-thrift/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-thrift jar diff --git a/dubbo-rpc/dubbo-rpc-webservice/pom.xml b/dubbo-rpc/dubbo-rpc-webservice/pom.xml index 30f6ae97612..accd615a3b6 100644 --- a/dubbo-rpc/dubbo-rpc-webservice/pom.xml +++ b/dubbo-rpc/dubbo-rpc-webservice/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc-webservice jar diff --git a/dubbo-rpc/pom.xml b/dubbo-rpc/pom.xml index 2f5081654f7..c9db02355b6 100644 --- a/dubbo-rpc/pom.xml +++ b/dubbo-rpc/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-rpc pom diff --git a/dubbo-serialization/dubbo-serialization-api/pom.xml b/dubbo-serialization/dubbo-serialization-api/pom.xml index 8adba7e3d86..a04402d8e18 100644 --- a/dubbo-serialization/dubbo-serialization-api/pom.xml +++ b/dubbo-serialization/dubbo-serialization-api/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5-SNAPSHOT + 2.6.5 dubbo-serialization-api jar diff --git a/dubbo-serialization/dubbo-serialization-fastjson/pom.xml b/dubbo-serialization/dubbo-serialization-fastjson/pom.xml index fa047801c00..b38a955addf 100644 --- a/dubbo-serialization/dubbo-serialization-fastjson/pom.xml +++ b/dubbo-serialization/dubbo-serialization-fastjson/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5-SNAPSHOT + 2.6.5 dubbo-serialization-fastjson jar diff --git a/dubbo-serialization/dubbo-serialization-fst/pom.xml b/dubbo-serialization/dubbo-serialization-fst/pom.xml index cbfe588e962..051315c8f42 100644 --- a/dubbo-serialization/dubbo-serialization-fst/pom.xml +++ b/dubbo-serialization/dubbo-serialization-fst/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-serialization - 2.6.5-SNAPSHOT + 2.6.5 dubbo-serialization-fst jar diff --git a/dubbo-serialization/dubbo-serialization-hessian2/pom.xml b/dubbo-serialization/dubbo-serialization-hessian2/pom.xml index dc296f68bd0..79a3e4a61c1 100644 --- a/dubbo-serialization/dubbo-serialization-hessian2/pom.xml +++ b/dubbo-serialization/dubbo-serialization-hessian2/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5-SNAPSHOT + 2.6.5 dubbo-serialization-hessian2 jar diff --git a/dubbo-serialization/dubbo-serialization-jdk/pom.xml b/dubbo-serialization/dubbo-serialization-jdk/pom.xml index eaa3f7562ff..f459fd25cac 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/pom.xml +++ b/dubbo-serialization/dubbo-serialization-jdk/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5-SNAPSHOT + 2.6.5 dubbo-serialization-jdk jar diff --git a/dubbo-serialization/dubbo-serialization-kryo/pom.xml b/dubbo-serialization/dubbo-serialization-kryo/pom.xml index 49f11297b09..58aef227d9e 100644 --- a/dubbo-serialization/dubbo-serialization-kryo/pom.xml +++ b/dubbo-serialization/dubbo-serialization-kryo/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5-SNAPSHOT + 2.6.5 dubbo-serialization-kryo jar diff --git a/dubbo-serialization/pom.xml b/dubbo-serialization/pom.xml index b38ef1dfd5b..88a6e9d77b9 100644 --- a/dubbo-serialization/pom.xml +++ b/dubbo-serialization/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-serialization pom diff --git a/dubbo-test/dubbo-test-benchmark/pom.xml b/dubbo-test/dubbo-test-benchmark/pom.xml index 04300b16a75..359f6b58038 100644 --- a/dubbo-test/dubbo-test-benchmark/pom.xml +++ b/dubbo-test/dubbo-test-benchmark/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-test - 2.6.5-SNAPSHOT + 2.6.5 dubbo-test-benchmark jar diff --git a/dubbo-test/dubbo-test-compatibility/dubbo-test-spring3/pom.xml b/dubbo-test/dubbo-test-compatibility/dubbo-test-spring3/pom.xml index b001335bcc8..4e75ec5ae6a 100644 --- a/dubbo-test/dubbo-test-compatibility/dubbo-test-spring3/pom.xml +++ b/dubbo-test/dubbo-test-compatibility/dubbo-test-spring3/pom.xml @@ -19,7 +19,7 @@ dubbo-test-compatibility com.alibaba - 2.6.5-SNAPSHOT + 2.6.5 4.0.0 diff --git a/dubbo-test/dubbo-test-compatibility/pom.xml b/dubbo-test/dubbo-test-compatibility/pom.xml index 0234589ac76..3b8cae983f7 100644 --- a/dubbo-test/dubbo-test-compatibility/pom.xml +++ b/dubbo-test/dubbo-test-compatibility/pom.xml @@ -22,7 +22,7 @@ com.alibaba dubbo-test - 2.6.5-SNAPSHOT + 2.6.5 dubbo-test-compatibility pom diff --git a/dubbo-test/dubbo-test-examples/pom.xml b/dubbo-test/dubbo-test-examples/pom.xml index 3a1ce70fad4..99892f9186b 100644 --- a/dubbo-test/dubbo-test-examples/pom.xml +++ b/dubbo-test/dubbo-test-examples/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-test - 2.6.5-SNAPSHOT + 2.6.5 dubbo-test-examples jar diff --git a/dubbo-test/dubbo-test-integration/pom.xml b/dubbo-test/dubbo-test-integration/pom.xml index b6d28637ab2..6e40bd62bfa 100644 --- a/dubbo-test/dubbo-test-integration/pom.xml +++ b/dubbo-test/dubbo-test-integration/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-test - 2.6.5-SNAPSHOT + 2.6.5 dubbo-test-integration jar diff --git a/dubbo-test/pom.xml b/dubbo-test/pom.xml index 68e67283446..733dfa83c47 100644 --- a/dubbo-test/pom.xml +++ b/dubbo-test/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 dubbo-test pom @@ -203,7 +203,7 @@ com.alibaba dubbo-serialization-jdk - 2.6.5-SNAPSHOT + 2.6.5 org.hibernate diff --git a/pom.xml b/pom.xml index f12a635924b..5e3c2814d3a 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ com.alibaba dubbo-parent - 2.6.5-SNAPSHOT + 2.6.5 pom ${project.artifactId} @@ -45,7 +45,7 @@ https://github.com/apache/incubator-dubbo scm:git:https://github.com/apache/incubator-dubbo.git scm:git:https://github.com/apache/incubator-dubbo.git - HEAD + dubbo-2.6.5 @@ -150,7 +150,7 @@ com.alibaba dubbo-dependencies-bom - 2.6.5-SNAPSHOT + 2.6.5 pom import From 1be26c9965da9305762cb6539bbf4d215b7b79c0 Mon Sep 17 00:00:00 2001 From: cvictory Date: Tue, 13 Nov 2018 18:51:19 +0800 Subject: [PATCH 16/23] [maven-release-plugin] prepare for next development iteration --- all/pom.xml | 4 ++-- bom/pom.xml | 4 ++-- dependencies-bom/pom.xml | 4 ++-- distribution/pom.xml | 2 +- dubbo-bootstrap/pom.xml | 2 +- dubbo-cluster/pom.xml | 2 +- dubbo-common/pom.xml | 2 +- dubbo-config/dubbo-config-api/pom.xml | 2 +- dubbo-config/dubbo-config-spring/pom.xml | 2 +- dubbo-config/pom.xml | 2 +- dubbo-container/dubbo-container-api/pom.xml | 2 +- dubbo-container/dubbo-container-log4j/pom.xml | 2 +- dubbo-container/dubbo-container-logback/pom.xml | 2 +- dubbo-container/dubbo-container-spring/pom.xml | 2 +- dubbo-container/pom.xml | 2 +- dubbo-demo/dubbo-demo-api/pom.xml | 2 +- dubbo-demo/dubbo-demo-consumer/pom.xml | 2 +- dubbo-demo/dubbo-demo-provider/pom.xml | 2 +- dubbo-demo/pom.xml | 2 +- dubbo-filter/dubbo-filter-cache/pom.xml | 2 +- dubbo-filter/dubbo-filter-validation/pom.xml | 2 +- dubbo-filter/pom.xml | 2 +- dubbo-monitor/dubbo-monitor-api/pom.xml | 2 +- dubbo-monitor/dubbo-monitor-default/pom.xml | 2 +- dubbo-monitor/pom.xml | 2 +- dubbo-plugin/dubbo-qos/pom.xml | 2 +- dubbo-plugin/pom.xml | 2 +- dubbo-registry/dubbo-registry-api/pom.xml | 2 +- dubbo-registry/dubbo-registry-default/pom.xml | 2 +- dubbo-registry/dubbo-registry-multicast/pom.xml | 2 +- dubbo-registry/dubbo-registry-redis/pom.xml | 2 +- dubbo-registry/dubbo-registry-zookeeper/pom.xml | 2 +- dubbo-registry/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-api/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-grizzly/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-http/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-mina/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-netty/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-netty4/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-p2p/pom.xml | 2 +- dubbo-remoting/dubbo-remoting-zookeeper/pom.xml | 2 +- dubbo-remoting/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-api/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-dubbo/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-hessian/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-http/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-injvm/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-memcached/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-redis/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-rest/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-rmi/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-thrift/pom.xml | 2 +- dubbo-rpc/dubbo-rpc-webservice/pom.xml | 2 +- dubbo-rpc/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-api/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-fastjson/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-fst/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-hessian2/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-jdk/pom.xml | 2 +- dubbo-serialization/dubbo-serialization-kryo/pom.xml | 2 +- dubbo-serialization/pom.xml | 2 +- dubbo-test/dubbo-test-benchmark/pom.xml | 2 +- .../dubbo-test-compatibility/dubbo-test-spring3/pom.xml | 2 +- dubbo-test/dubbo-test-compatibility/pom.xml | 2 +- dubbo-test/dubbo-test-examples/pom.xml | 2 +- dubbo-test/dubbo-test-integration/pom.xml | 2 +- dubbo-test/pom.xml | 4 ++-- pom.xml | 6 +++--- 68 files changed, 74 insertions(+), 74 deletions(-) diff --git a/all/pom.xml b/all/pom.xml index eca7fed772f..4efe852dd0e 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -19,11 +19,11 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT ../pom.xml dubbo - 2.6.5 + 2.6.6-SNAPSHOT jar dubbo-all The all in one project of dubbo diff --git a/bom/pom.xml b/bom/pom.xml index 7083d6a1cc3..d8d2729652a 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -14,7 +14,7 @@ com.alibaba dubbo-bom - 2.6.5 + 2.6.6-SNAPSHOT pom dubbo-bom @@ -33,7 +33,7 @@ https://github.com/apache/incubator-dubbo scm:git:https://github.com/apache/incubator-dubbo.git scm:git:https://github.com/apache/incubator-dubbo.git - dubbo-2.6.5 + HEAD diff --git a/dependencies-bom/pom.xml b/dependencies-bom/pom.xml index 46519ee9cca..6628d90576a 100644 --- a/dependencies-bom/pom.xml +++ b/dependencies-bom/pom.xml @@ -10,7 +10,7 @@ com.alibaba dubbo-dependencies-bom - 2.6.5 + 2.6.6-SNAPSHOT pom dubbo-dependencies-bom @@ -29,7 +29,7 @@ https://github.com/apache/incubator-dubbo scm:git:https://github.com/apache/incubator-dubbo.git scm:git:https://github.com/apache/incubator-dubbo.git - dubbo-2.6.5 + HEAD diff --git a/distribution/pom.xml b/distribution/pom.xml index 2f584f24769..9b6d55ed01e 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-distribution pom diff --git a/dubbo-bootstrap/pom.xml b/dubbo-bootstrap/pom.xml index c85ecf51fe7..43a1c9fcf60 100644 --- a/dubbo-bootstrap/pom.xml +++ b/dubbo-bootstrap/pom.xml @@ -18,7 +18,7 @@ dubbo-parent com.alibaba - 2.6.5 + 2.6.6-SNAPSHOT 4.0.0 diff --git a/dubbo-cluster/pom.xml b/dubbo-cluster/pom.xml index e8276a8a6e6..3f7b223ecbd 100644 --- a/dubbo-cluster/pom.xml +++ b/dubbo-cluster/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-cluster jar diff --git a/dubbo-common/pom.xml b/dubbo-common/pom.xml index d40c1f2a794..b75de81e1cf 100644 --- a/dubbo-common/pom.xml +++ b/dubbo-common/pom.xml @@ -20,7 +20,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-common jar diff --git a/dubbo-config/dubbo-config-api/pom.xml b/dubbo-config/dubbo-config-api/pom.xml index 4e86288c8e8..1acfb5c340b 100644 --- a/dubbo-config/dubbo-config-api/pom.xml +++ b/dubbo-config/dubbo-config-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-config - 2.6.5 + 2.6.6-SNAPSHOT dubbo-config-api jar diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml index 1c8c847e253..69b9f82ef9f 100644 --- a/dubbo-config/dubbo-config-spring/pom.xml +++ b/dubbo-config/dubbo-config-spring/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-config - 2.6.5 + 2.6.6-SNAPSHOT dubbo-config-spring jar diff --git a/dubbo-config/pom.xml b/dubbo-config/pom.xml index 66f3f80034b..ac26e99254a 100644 --- a/dubbo-config/pom.xml +++ b/dubbo-config/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-config pom diff --git a/dubbo-container/dubbo-container-api/pom.xml b/dubbo-container/dubbo-container-api/pom.xml index 40b42f0e794..5917c5fc1f1 100644 --- a/dubbo-container/dubbo-container-api/pom.xml +++ b/dubbo-container/dubbo-container-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-container - 2.6.5 + 2.6.6-SNAPSHOT dubbo-container-api jar diff --git a/dubbo-container/dubbo-container-log4j/pom.xml b/dubbo-container/dubbo-container-log4j/pom.xml index e572024f2cf..2f9ff270248 100644 --- a/dubbo-container/dubbo-container-log4j/pom.xml +++ b/dubbo-container/dubbo-container-log4j/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-container - 2.6.5 + 2.6.6-SNAPSHOT dubbo-container-log4j jar diff --git a/dubbo-container/dubbo-container-logback/pom.xml b/dubbo-container/dubbo-container-logback/pom.xml index 28bdcd3f93b..713c639ba9d 100644 --- a/dubbo-container/dubbo-container-logback/pom.xml +++ b/dubbo-container/dubbo-container-logback/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-container - 2.6.5 + 2.6.6-SNAPSHOT dubbo-container-logback jar diff --git a/dubbo-container/dubbo-container-spring/pom.xml b/dubbo-container/dubbo-container-spring/pom.xml index d1f777e01bc..6508c55ae41 100644 --- a/dubbo-container/dubbo-container-spring/pom.xml +++ b/dubbo-container/dubbo-container-spring/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-container - 2.6.5 + 2.6.6-SNAPSHOT dubbo-container-spring jar diff --git a/dubbo-container/pom.xml b/dubbo-container/pom.xml index e4d7c7b016e..3f7d91a3957 100644 --- a/dubbo-container/pom.xml +++ b/dubbo-container/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-container pom diff --git a/dubbo-demo/dubbo-demo-api/pom.xml b/dubbo-demo/dubbo-demo-api/pom.xml index d85884be3d6..854dd9e2bb3 100644 --- a/dubbo-demo/dubbo-demo-api/pom.xml +++ b/dubbo-demo/dubbo-demo-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-demo - 2.6.5 + 2.6.6-SNAPSHOT dubbo-demo-api jar diff --git a/dubbo-demo/dubbo-demo-consumer/pom.xml b/dubbo-demo/dubbo-demo-consumer/pom.xml index d208a61faa3..d43d6fc0eaf 100644 --- a/dubbo-demo/dubbo-demo-consumer/pom.xml +++ b/dubbo-demo/dubbo-demo-consumer/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-demo - 2.6.5 + 2.6.6-SNAPSHOT dubbo-demo-consumer jar diff --git a/dubbo-demo/dubbo-demo-provider/pom.xml b/dubbo-demo/dubbo-demo-provider/pom.xml index 49ac84955e7..f6bb48bb0ed 100644 --- a/dubbo-demo/dubbo-demo-provider/pom.xml +++ b/dubbo-demo/dubbo-demo-provider/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-demo - 2.6.5 + 2.6.6-SNAPSHOT dubbo-demo-provider jar diff --git a/dubbo-demo/pom.xml b/dubbo-demo/pom.xml index 3798be05bf1..436169b1930 100644 --- a/dubbo-demo/pom.xml +++ b/dubbo-demo/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-demo pom diff --git a/dubbo-filter/dubbo-filter-cache/pom.xml b/dubbo-filter/dubbo-filter-cache/pom.xml index 1d09d45bf37..074187703b4 100644 --- a/dubbo-filter/dubbo-filter-cache/pom.xml +++ b/dubbo-filter/dubbo-filter-cache/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-filter - 2.6.5 + 2.6.6-SNAPSHOT dubbo-filter-cache jar diff --git a/dubbo-filter/dubbo-filter-validation/pom.xml b/dubbo-filter/dubbo-filter-validation/pom.xml index 1010109a772..6fd02fea9e7 100644 --- a/dubbo-filter/dubbo-filter-validation/pom.xml +++ b/dubbo-filter/dubbo-filter-validation/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-filter - 2.6.5 + 2.6.6-SNAPSHOT dubbo-filter-validation jar diff --git a/dubbo-filter/pom.xml b/dubbo-filter/pom.xml index 060661855f0..705e2841c31 100644 --- a/dubbo-filter/pom.xml +++ b/dubbo-filter/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-filter pom diff --git a/dubbo-monitor/dubbo-monitor-api/pom.xml b/dubbo-monitor/dubbo-monitor-api/pom.xml index fa34909d4f1..f3e0f0a5141 100644 --- a/dubbo-monitor/dubbo-monitor-api/pom.xml +++ b/dubbo-monitor/dubbo-monitor-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-monitor - 2.6.5 + 2.6.6-SNAPSHOT dubbo-monitor-api jar diff --git a/dubbo-monitor/dubbo-monitor-default/pom.xml b/dubbo-monitor/dubbo-monitor-default/pom.xml index 43ed6efe012..b1d3c53cf97 100644 --- a/dubbo-monitor/dubbo-monitor-default/pom.xml +++ b/dubbo-monitor/dubbo-monitor-default/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-monitor - 2.6.5 + 2.6.6-SNAPSHOT dubbo-monitor-default jar diff --git a/dubbo-monitor/pom.xml b/dubbo-monitor/pom.xml index 15e80d3627a..794ea247a2f 100644 --- a/dubbo-monitor/pom.xml +++ b/dubbo-monitor/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-monitor pom diff --git a/dubbo-plugin/dubbo-qos/pom.xml b/dubbo-plugin/dubbo-qos/pom.xml index d77fb9cceba..6b84c351458 100644 --- a/dubbo-plugin/dubbo-qos/pom.xml +++ b/dubbo-plugin/dubbo-qos/pom.xml @@ -18,7 +18,7 @@ com.alibaba dubbo-plugin - 2.6.5 + 2.6.6-SNAPSHOT 4.0.0 diff --git a/dubbo-plugin/pom.xml b/dubbo-plugin/pom.xml index ef790530dc7..9623425fe8f 100644 --- a/dubbo-plugin/pom.xml +++ b/dubbo-plugin/pom.xml @@ -18,7 +18,7 @@ dubbo-parent com.alibaba - 2.6.5 + 2.6.6-SNAPSHOT 4.0.0 diff --git a/dubbo-registry/dubbo-registry-api/pom.xml b/dubbo-registry/dubbo-registry-api/pom.xml index 4361a22e4a6..bacc5ccf119 100644 --- a/dubbo-registry/dubbo-registry-api/pom.xml +++ b/dubbo-registry/dubbo-registry-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-registry - 2.6.5 + 2.6.6-SNAPSHOT dubbo-registry-api jar diff --git a/dubbo-registry/dubbo-registry-default/pom.xml b/dubbo-registry/dubbo-registry-default/pom.xml index de4b1a0a75d..2de38840de6 100644 --- a/dubbo-registry/dubbo-registry-default/pom.xml +++ b/dubbo-registry/dubbo-registry-default/pom.xml @@ -20,7 +20,7 @@ com.alibaba dubbo-registry - 2.6.5 + 2.6.6-SNAPSHOT dubbo-registry-default jar diff --git a/dubbo-registry/dubbo-registry-multicast/pom.xml b/dubbo-registry/dubbo-registry-multicast/pom.xml index 6826a3e1b6f..bb0981caf7f 100644 --- a/dubbo-registry/dubbo-registry-multicast/pom.xml +++ b/dubbo-registry/dubbo-registry-multicast/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-registry - 2.6.5 + 2.6.6-SNAPSHOT dubbo-registry-multicast jar diff --git a/dubbo-registry/dubbo-registry-redis/pom.xml b/dubbo-registry/dubbo-registry-redis/pom.xml index 8f9328c3fb6..21a509833e3 100644 --- a/dubbo-registry/dubbo-registry-redis/pom.xml +++ b/dubbo-registry/dubbo-registry-redis/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-registry - 2.6.5 + 2.6.6-SNAPSHOT dubbo-registry-redis jar diff --git a/dubbo-registry/dubbo-registry-zookeeper/pom.xml b/dubbo-registry/dubbo-registry-zookeeper/pom.xml index ffc50ad2019..e4ce25724a6 100644 --- a/dubbo-registry/dubbo-registry-zookeeper/pom.xml +++ b/dubbo-registry/dubbo-registry-zookeeper/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-registry - 2.6.5 + 2.6.6-SNAPSHOT dubbo-registry-zookeeper jar diff --git a/dubbo-registry/pom.xml b/dubbo-registry/pom.xml index 224eff6d2d8..b268a88d785 100644 --- a/dubbo-registry/pom.xml +++ b/dubbo-registry/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-registry pom diff --git a/dubbo-remoting/dubbo-remoting-api/pom.xml b/dubbo-remoting/dubbo-remoting-api/pom.xml index 204af112493..f64844c51ee 100644 --- a/dubbo-remoting/dubbo-remoting-api/pom.xml +++ b/dubbo-remoting/dubbo-remoting-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5 + 2.6.6-SNAPSHOT dubbo-remoting-api jar diff --git a/dubbo-remoting/dubbo-remoting-grizzly/pom.xml b/dubbo-remoting/dubbo-remoting-grizzly/pom.xml index 77513cd54ff..234d7236a4b 100644 --- a/dubbo-remoting/dubbo-remoting-grizzly/pom.xml +++ b/dubbo-remoting/dubbo-remoting-grizzly/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5 + 2.6.6-SNAPSHOT dubbo-remoting-grizzly jar diff --git a/dubbo-remoting/dubbo-remoting-http/pom.xml b/dubbo-remoting/dubbo-remoting-http/pom.xml index f5236059304..cb49c834876 100644 --- a/dubbo-remoting/dubbo-remoting-http/pom.xml +++ b/dubbo-remoting/dubbo-remoting-http/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5 + 2.6.6-SNAPSHOT dubbo-remoting-http jar diff --git a/dubbo-remoting/dubbo-remoting-mina/pom.xml b/dubbo-remoting/dubbo-remoting-mina/pom.xml index 9bbc7f1ab3a..ef745944e10 100644 --- a/dubbo-remoting/dubbo-remoting-mina/pom.xml +++ b/dubbo-remoting/dubbo-remoting-mina/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5 + 2.6.6-SNAPSHOT dubbo-remoting-mina jar diff --git a/dubbo-remoting/dubbo-remoting-netty/pom.xml b/dubbo-remoting/dubbo-remoting-netty/pom.xml index 7a8bc0f4cd2..a51d3a35f76 100644 --- a/dubbo-remoting/dubbo-remoting-netty/pom.xml +++ b/dubbo-remoting/dubbo-remoting-netty/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5 + 2.6.6-SNAPSHOT dubbo-remoting-netty jar diff --git a/dubbo-remoting/dubbo-remoting-netty4/pom.xml b/dubbo-remoting/dubbo-remoting-netty4/pom.xml index 7fb00ce4e52..b8aba0c7899 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/pom.xml +++ b/dubbo-remoting/dubbo-remoting-netty4/pom.xml @@ -18,7 +18,7 @@ dubbo-remoting com.alibaba - 2.6.5 + 2.6.6-SNAPSHOT 4.0.0 diff --git a/dubbo-remoting/dubbo-remoting-p2p/pom.xml b/dubbo-remoting/dubbo-remoting-p2p/pom.xml index 77c2a7da9a1..f7133d44581 100644 --- a/dubbo-remoting/dubbo-remoting-p2p/pom.xml +++ b/dubbo-remoting/dubbo-remoting-p2p/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5 + 2.6.6-SNAPSHOT dubbo-remoting-p2p jar diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml index ff7ee1ea9e1..e7fa18ab190 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml +++ b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-remoting - 2.6.5 + 2.6.6-SNAPSHOT dubbo-remoting-zookeeper jar diff --git a/dubbo-remoting/pom.xml b/dubbo-remoting/pom.xml index 14bfa482b7b..18c87cbe91f 100644 --- a/dubbo-remoting/pom.xml +++ b/dubbo-remoting/pom.xml @@ -20,7 +20,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-remoting pom diff --git a/dubbo-rpc/dubbo-rpc-api/pom.xml b/dubbo-rpc/dubbo-rpc-api/pom.xml index f7368213f95..7f3b979274e 100644 --- a/dubbo-rpc/dubbo-rpc-api/pom.xml +++ b/dubbo-rpc/dubbo-rpc-api/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-api jar diff --git a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml index d659552d314..5f9d62c202e 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml +++ b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-dubbo jar diff --git a/dubbo-rpc/dubbo-rpc-hessian/pom.xml b/dubbo-rpc/dubbo-rpc-hessian/pom.xml index bc9c6acc700..1ad7542c645 100644 --- a/dubbo-rpc/dubbo-rpc-hessian/pom.xml +++ b/dubbo-rpc/dubbo-rpc-hessian/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-hessian jar diff --git a/dubbo-rpc/dubbo-rpc-http/pom.xml b/dubbo-rpc/dubbo-rpc-http/pom.xml index b03cb6c49d0..2caf8b54a7b 100644 --- a/dubbo-rpc/dubbo-rpc-http/pom.xml +++ b/dubbo-rpc/dubbo-rpc-http/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-http jar diff --git a/dubbo-rpc/dubbo-rpc-injvm/pom.xml b/dubbo-rpc/dubbo-rpc-injvm/pom.xml index 3e2dad53aa9..94244d1c390 100644 --- a/dubbo-rpc/dubbo-rpc-injvm/pom.xml +++ b/dubbo-rpc/dubbo-rpc-injvm/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-injvm jar diff --git a/dubbo-rpc/dubbo-rpc-memcached/pom.xml b/dubbo-rpc/dubbo-rpc-memcached/pom.xml index a035da0ab7f..735635df48f 100644 --- a/dubbo-rpc/dubbo-rpc-memcached/pom.xml +++ b/dubbo-rpc/dubbo-rpc-memcached/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-memcached jar diff --git a/dubbo-rpc/dubbo-rpc-redis/pom.xml b/dubbo-rpc/dubbo-rpc-redis/pom.xml index 783097e629a..fdc3e6e1673 100644 --- a/dubbo-rpc/dubbo-rpc-redis/pom.xml +++ b/dubbo-rpc/dubbo-rpc-redis/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-redis jar diff --git a/dubbo-rpc/dubbo-rpc-rest/pom.xml b/dubbo-rpc/dubbo-rpc-rest/pom.xml index c978f796256..241782a0e2f 100644 --- a/dubbo-rpc/dubbo-rpc-rest/pom.xml +++ b/dubbo-rpc/dubbo-rpc-rest/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-rest jar diff --git a/dubbo-rpc/dubbo-rpc-rmi/pom.xml b/dubbo-rpc/dubbo-rpc-rmi/pom.xml index 0f580c63511..3cdcc8dfb7c 100644 --- a/dubbo-rpc/dubbo-rpc-rmi/pom.xml +++ b/dubbo-rpc/dubbo-rpc-rmi/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-rmi jar diff --git a/dubbo-rpc/dubbo-rpc-thrift/pom.xml b/dubbo-rpc/dubbo-rpc-thrift/pom.xml index 3f07c82d9cb..ed73b9e74d4 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/pom.xml +++ b/dubbo-rpc/dubbo-rpc-thrift/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-thrift jar diff --git a/dubbo-rpc/dubbo-rpc-webservice/pom.xml b/dubbo-rpc/dubbo-rpc-webservice/pom.xml index accd615a3b6..69ae7df8eb3 100644 --- a/dubbo-rpc/dubbo-rpc-webservice/pom.xml +++ b/dubbo-rpc/dubbo-rpc-webservice/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-rpc - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc-webservice jar diff --git a/dubbo-rpc/pom.xml b/dubbo-rpc/pom.xml index c9db02355b6..daae30bad50 100644 --- a/dubbo-rpc/pom.xml +++ b/dubbo-rpc/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-rpc pom diff --git a/dubbo-serialization/dubbo-serialization-api/pom.xml b/dubbo-serialization/dubbo-serialization-api/pom.xml index a04402d8e18..b98f512e576 100644 --- a/dubbo-serialization/dubbo-serialization-api/pom.xml +++ b/dubbo-serialization/dubbo-serialization-api/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5 + 2.6.6-SNAPSHOT dubbo-serialization-api jar diff --git a/dubbo-serialization/dubbo-serialization-fastjson/pom.xml b/dubbo-serialization/dubbo-serialization-fastjson/pom.xml index b38a955addf..ab60f9805ab 100644 --- a/dubbo-serialization/dubbo-serialization-fastjson/pom.xml +++ b/dubbo-serialization/dubbo-serialization-fastjson/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5 + 2.6.6-SNAPSHOT dubbo-serialization-fastjson jar diff --git a/dubbo-serialization/dubbo-serialization-fst/pom.xml b/dubbo-serialization/dubbo-serialization-fst/pom.xml index 051315c8f42..3374b4e494c 100644 --- a/dubbo-serialization/dubbo-serialization-fst/pom.xml +++ b/dubbo-serialization/dubbo-serialization-fst/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-serialization - 2.6.5 + 2.6.6-SNAPSHOT dubbo-serialization-fst jar diff --git a/dubbo-serialization/dubbo-serialization-hessian2/pom.xml b/dubbo-serialization/dubbo-serialization-hessian2/pom.xml index 79a3e4a61c1..fa3d1f6769d 100644 --- a/dubbo-serialization/dubbo-serialization-hessian2/pom.xml +++ b/dubbo-serialization/dubbo-serialization-hessian2/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5 + 2.6.6-SNAPSHOT dubbo-serialization-hessian2 jar diff --git a/dubbo-serialization/dubbo-serialization-jdk/pom.xml b/dubbo-serialization/dubbo-serialization-jdk/pom.xml index f459fd25cac..112ebcc212e 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/pom.xml +++ b/dubbo-serialization/dubbo-serialization-jdk/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5 + 2.6.6-SNAPSHOT dubbo-serialization-jdk jar diff --git a/dubbo-serialization/dubbo-serialization-kryo/pom.xml b/dubbo-serialization/dubbo-serialization-kryo/pom.xml index 58aef227d9e..ae16fc9eeb2 100644 --- a/dubbo-serialization/dubbo-serialization-kryo/pom.xml +++ b/dubbo-serialization/dubbo-serialization-kryo/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.alibaba dubbo-serialization - 2.6.5 + 2.6.6-SNAPSHOT dubbo-serialization-kryo jar diff --git a/dubbo-serialization/pom.xml b/dubbo-serialization/pom.xml index 88a6e9d77b9..2be8ba66df8 100644 --- a/dubbo-serialization/pom.xml +++ b/dubbo-serialization/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-serialization pom diff --git a/dubbo-test/dubbo-test-benchmark/pom.xml b/dubbo-test/dubbo-test-benchmark/pom.xml index 359f6b58038..e4578cdddb2 100644 --- a/dubbo-test/dubbo-test-benchmark/pom.xml +++ b/dubbo-test/dubbo-test-benchmark/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-test - 2.6.5 + 2.6.6-SNAPSHOT dubbo-test-benchmark jar diff --git a/dubbo-test/dubbo-test-compatibility/dubbo-test-spring3/pom.xml b/dubbo-test/dubbo-test-compatibility/dubbo-test-spring3/pom.xml index 4e75ec5ae6a..45a1f29c282 100644 --- a/dubbo-test/dubbo-test-compatibility/dubbo-test-spring3/pom.xml +++ b/dubbo-test/dubbo-test-compatibility/dubbo-test-spring3/pom.xml @@ -19,7 +19,7 @@ dubbo-test-compatibility com.alibaba - 2.6.5 + 2.6.6-SNAPSHOT 4.0.0 diff --git a/dubbo-test/dubbo-test-compatibility/pom.xml b/dubbo-test/dubbo-test-compatibility/pom.xml index 3b8cae983f7..8aba1cd7678 100644 --- a/dubbo-test/dubbo-test-compatibility/pom.xml +++ b/dubbo-test/dubbo-test-compatibility/pom.xml @@ -22,7 +22,7 @@ com.alibaba dubbo-test - 2.6.5 + 2.6.6-SNAPSHOT dubbo-test-compatibility pom diff --git a/dubbo-test/dubbo-test-examples/pom.xml b/dubbo-test/dubbo-test-examples/pom.xml index 99892f9186b..d672d5ff03d 100644 --- a/dubbo-test/dubbo-test-examples/pom.xml +++ b/dubbo-test/dubbo-test-examples/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-test - 2.6.5 + 2.6.6-SNAPSHOT dubbo-test-examples jar diff --git a/dubbo-test/dubbo-test-integration/pom.xml b/dubbo-test/dubbo-test-integration/pom.xml index 6e40bd62bfa..91873a87eb6 100644 --- a/dubbo-test/dubbo-test-integration/pom.xml +++ b/dubbo-test/dubbo-test-integration/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-test - 2.6.5 + 2.6.6-SNAPSHOT dubbo-test-integration jar diff --git a/dubbo-test/pom.xml b/dubbo-test/pom.xml index 733dfa83c47..ebfced6a400 100644 --- a/dubbo-test/pom.xml +++ b/dubbo-test/pom.xml @@ -19,7 +19,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT dubbo-test pom @@ -203,7 +203,7 @@ com.alibaba dubbo-serialization-jdk - 2.6.5 + 2.6.6-SNAPSHOT org.hibernate diff --git a/pom.xml b/pom.xml index 5e3c2814d3a..d1f37a98e66 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ com.alibaba dubbo-parent - 2.6.5 + 2.6.6-SNAPSHOT pom ${project.artifactId} @@ -45,7 +45,7 @@ https://github.com/apache/incubator-dubbo scm:git:https://github.com/apache/incubator-dubbo.git scm:git:https://github.com/apache/incubator-dubbo.git - dubbo-2.6.5 + HEAD @@ -150,7 +150,7 @@ com.alibaba dubbo-dependencies-bom - 2.6.5 + 2.6.6-SNAPSHOT pom import From 0e50d65511f826c604c59c01a398db44235552d1 Mon Sep 17 00:00:00 2001 From: kexianjun Date: Tue, 20 Nov 2018 12:28:46 +0800 Subject: [PATCH 17/23] fix 2798 on branch 2.6.x (#2805) 'propertyname in java donot contain '-' but camel format'. --- .../config/spring/schema/DubboBeanDefinitionParser.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboBeanDefinitionParser.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboBeanDefinitionParser.java index 48192a94877..df6adae220e 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboBeanDefinitionParser.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboBeanDefinitionParser.java @@ -135,7 +135,8 @@ private static BeanDefinition parse(Element element, ParserContext parserContext && Modifier.isPublic(setter.getModifiers()) && setter.getParameterTypes().length == 1) { Class type = setter.getParameterTypes()[0]; - String property = StringUtils.camelToSplitName(name.substring(3, 4).toLowerCase() + name.substring(4), "-"); + String propertyName = name.substring(3, 4).toLowerCase() + name.substring(4); + String property = StringUtils.camelToSplitName(propertyName, "-"); props.add(property); Method getter = null; try { @@ -223,7 +224,7 @@ private static BeanDefinition parse(Element element, ParserContext parserContext } reference = new RuntimeBeanReference(value); } - beanDefinition.getPropertyValues().addPropertyValue(property, reference); + beanDefinition.getPropertyValues().addPropertyValue(propertyName, reference); } } } From ac49a7d34ac6cfe5ff089d9823bdad1171409c00 Mon Sep 17 00:00:00 2001 From: huazhongming Date: Tue, 4 Dec 2018 10:05:42 +0800 Subject: [PATCH 18/23] Remove extra modifiers (#2876) Remove extra modifiers --- .../src/main/java/com/alibaba/dubbo/remoting/Decodeable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Decodeable.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Decodeable.java index 733fe213c52..dfb68825b65 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Decodeable.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Decodeable.java @@ -19,6 +19,6 @@ public interface Decodeable { - public void decode() throws Exception; + void decode() throws Exception; } From 3375ec827845a0b133eae1fd4aad78aeb203361a Mon Sep 17 00:00:00 2001 From: xujingfeng <250577914@qq.com> Date: Thu, 17 Jan 2019 16:47:53 +0800 Subject: [PATCH 19/23] feature:import TagRouter (#3065) --- .../com/alibaba/dubbo/rpc/cluster/Router.java | 9 +- .../cluster/directory/AbstractDirectory.java | 2 + .../rpc/cluster/router/AbstractRouter.java | 40 ++ .../cluster/router/MockInvokersSelector.java | 20 +- .../router/condition/ConditionRouter.java | 9 +- .../cluster/router/script/ScriptRouter.java | 27 +- .../rpc/cluster/router/tag/TagRouter.java | 79 +++ .../cluster/loadbalance/LoadBalanceTest.java | 14 +- .../rpc/cluster/router/tag/TagRouterTest.java | 153 ++++++ .../com/alibaba/dubbo/common/Constants.java | 4 + .../dubbo/config/AbstractServiceConfig.java | 498 +++++++++--------- .../dubbo/config/annotation/Service.java | 2 + .../dubbo/config/spring/AnnotationBean.java | 3 + .../main/resources/META-INF/compat/dubbo.xsd | 5 + .../src/main/resources/META-INF/dubbo.xsd | 5 + .../integration/RegistryDirectory.java | 3 +- .../registry/dubbo/RegistryDirectoryTest.java | 10 +- .../dubbo/DubboInvokerAvilableTest.java | 13 +- 18 files changed, 594 insertions(+), 302 deletions(-) create mode 100644 dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/AbstractRouter.java create mode 100644 dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/tag/TagRouter.java create mode 100644 dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/router/tag/TagRouterTest.java diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java index a5eea1c9bf6..f4471839716 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java @@ -31,7 +31,7 @@ * @see com.alibaba.dubbo.rpc.cluster.Cluster#join(Directory) * @see com.alibaba.dubbo.rpc.cluster.Directory#list(Invocation) */ -public interface Router extends Comparable { +public interface Router extends Comparable{ /** * get the router url. @@ -51,4 +51,11 @@ public interface Router extends Comparable { */ List> route(List> invokers, URL url, Invocation invocation) throws RpcException; + /** + * Router's priority, used to sort routers. + * + * @return router's priority + */ + int getPriority(); + } \ No newline at end of file diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/directory/AbstractDirectory.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/directory/AbstractDirectory.java index 6934069ee94..31764af25fe 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/directory/AbstractDirectory.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/directory/AbstractDirectory.java @@ -28,6 +28,7 @@ import com.alibaba.dubbo.rpc.cluster.Router; import com.alibaba.dubbo.rpc.cluster.RouterFactory; import com.alibaba.dubbo.rpc.cluster.router.MockInvokersSelector; +import com.alibaba.dubbo.rpc.cluster.router.tag.TagRouter; import java.util.ArrayList; import java.util.Collections; @@ -107,6 +108,7 @@ protected void setRouters(List routers) { } // append mock invoker selector routers.add(new MockInvokersSelector()); + routers.add(new TagRouter()); Collections.sort(routers); this.routers = routers; } diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/AbstractRouter.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/AbstractRouter.java new file mode 100644 index 00000000000..6b5cbcfbb22 --- /dev/null +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/AbstractRouter.java @@ -0,0 +1,40 @@ +/* + * 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 com.alibaba.dubbo.rpc.cluster.router; + +import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.rpc.cluster.Router; + +public abstract class AbstractRouter implements Router { + + protected URL url; + protected int priority; + + @Override + public URL getUrl() { + return url; + } + + @Override + public int compareTo(Router o) { + return (this.getPriority() < o.getPriority()) ? -1 : ((this.getPriority() == o.getPriority()) ? 0 : 1); + } + + public int getPriority() { + return priority; + } +} diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/MockInvokersSelector.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/MockInvokersSelector.java index d406f78da4f..089c8dadf88 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/MockInvokersSelector.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/MockInvokersSelector.java @@ -21,7 +21,6 @@ import com.alibaba.dubbo.rpc.Invocation; import com.alibaba.dubbo.rpc.Invoker; import com.alibaba.dubbo.rpc.RpcException; -import com.alibaba.dubbo.rpc.cluster.Router; import java.util.ArrayList; import java.util.List; @@ -29,9 +28,14 @@ /** * A specific Router designed to realize mock feature. * If a request is configured to use mock, then this router guarantees that only the invokers with protocol MOCK appear in final the invoker list, all other invokers will be excluded. - * */ -public class MockInvokersSelector implements Router { +public class MockInvokersSelector extends AbstractRouter { + + private static final int DEFAULT_PRIORITY = Integer.MAX_VALUE; + + public MockInvokersSelector() { + this.priority = DEFAULT_PRIORITY; + } @Override public List> route(final List> invokers, @@ -87,14 +91,4 @@ private boolean hasMockProviders(final List> invokers) { return hasMockProvider; } - @Override - public URL getUrl() { - return null; - } - - @Override - public int compareTo(Router o) { - return 1; - } - } diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java index 05f1d7136dc..961b66a05f5 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java @@ -27,6 +27,7 @@ import com.alibaba.dubbo.rpc.Invoker; import com.alibaba.dubbo.rpc.RpcException; import com.alibaba.dubbo.rpc.cluster.Router; +import com.alibaba.dubbo.rpc.cluster.router.AbstractRouter; import java.text.ParseException; import java.util.ArrayList; @@ -40,21 +41,19 @@ /** * ConditionRouter - * */ -public class ConditionRouter implements Router, Comparable { +public class ConditionRouter extends AbstractRouter { private static final Logger logger = LoggerFactory.getLogger(ConditionRouter.class); + private static final int DEFAULT_PRIORITY = 2; private static Pattern ROUTE_PATTERN = Pattern.compile("([&!=,]*)\\s*([^&!=,\\s]+)"); - private final URL url; - private final int priority; private final boolean force; private final Map whenCondition; private final Map thenCondition; public ConditionRouter(URL url) { this.url = url; - this.priority = url.getParameter(Constants.PRIORITY_KEY, 0); + this.priority = url.getParameter(Constants.PRIORITY_KEY, DEFAULT_PRIORITY); this.force = url.getParameter(Constants.FORCE_KEY, false); try { String rule = url.getParameterAndDecoded(Constants.RULE_KEY); diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/script/ScriptRouter.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/script/ScriptRouter.java index 74938c6439e..89241ad722e 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/script/ScriptRouter.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/script/ScriptRouter.java @@ -24,7 +24,7 @@ import com.alibaba.dubbo.rpc.Invoker; import com.alibaba.dubbo.rpc.RpcContext; import com.alibaba.dubbo.rpc.RpcException; -import com.alibaba.dubbo.rpc.cluster.Router; +import com.alibaba.dubbo.rpc.cluster.router.AbstractRouter; import javax.script.Bindings; import javax.script.Compilable; @@ -40,26 +40,23 @@ /** * ScriptRouter - * */ -public class ScriptRouter implements Router { +public class ScriptRouter extends AbstractRouter { private static final Logger logger = LoggerFactory.getLogger(ScriptRouter.class); + private static final int DEFAULT_PRIORITY = 1; + private static final Map engines = new ConcurrentHashMap(); private final ScriptEngine engine; - private final int priority; - private final String rule; - private final URL url; - public ScriptRouter(URL url) { this.url = url; String type = url.getParameter(Constants.TYPE_KEY); - this.priority = url.getParameter(Constants.PRIORITY_KEY, 0); + this.priority = url.getParameter(Constants.PRIORITY_KEY, DEFAULT_PRIORITY); String rule = url.getParameterAndDecoded(Constants.RULE_KEY); if (type == null || type.length() == 0) { type = Constants.DEFAULT_SCRIPT_TYPE_KEY; @@ -79,11 +76,6 @@ public ScriptRouter(URL url) { this.rule = rule; } - @Override - public URL getUrl() { - return url; - } - @Override @SuppressWarnings("unchecked") public List> route(List> invokers, URL url, Invocation invocation) throws RpcException { @@ -114,13 +106,4 @@ public List> route(List> invokers, URL url, Invocation } } - @Override - public int compareTo(Router o) { - if (o == null || o.getClass() != ScriptRouter.class) { - return 1; - } - ScriptRouter c = (ScriptRouter) o; - return this.priority == c.priority ? rule.compareTo(c.rule) : (this.priority > c.priority ? 1 : -1); - } - } diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/tag/TagRouter.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/tag/TagRouter.java new file mode 100644 index 00000000000..b1b0d4f7a9d --- /dev/null +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/tag/TagRouter.java @@ -0,0 +1,79 @@ +/* + * 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 com.alibaba.dubbo.rpc.cluster.router.tag; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.common.utils.StringUtils; +import com.alibaba.dubbo.rpc.Invocation; +import com.alibaba.dubbo.rpc.Invoker; +import com.alibaba.dubbo.rpc.RpcContext; +import com.alibaba.dubbo.rpc.RpcException; +import com.alibaba.dubbo.rpc.cluster.router.AbstractRouter; + +import java.util.ArrayList; +import java.util.List; + +/** + * TagRouter + */ +public class TagRouter extends AbstractRouter { + + private static final int DEFAULT_PRIORITY = 100; + private static final URL ROUTER_URL = new URL("tag", Constants.ANYHOST_VALUE, 0, Constants.ANY_VALUE).addParameters(Constants.RUNTIME_KEY, "true"); + + public TagRouter() { + this.url = ROUTER_URL; + this.priority = url.getParameter(Constants.PRIORITY_KEY, DEFAULT_PRIORITY); + } + + @Override + public URL getUrl() { + return url; + } + + @Override + public List> route(List> invokers, URL url, Invocation invocation) throws RpcException { + // filter + List> result = new ArrayList>(); + // Dynamic param + String tag = RpcContext.getContext().getAttachment(Constants.TAG_KEY); + // Tag request + if (!StringUtils.isEmpty(tag)) { + // Select tag invokers first + for (Invoker invoker : invokers) { + if (tag.equals(invoker.getUrl().getParameter(Constants.TAG_KEY))) { + result.add(invoker); + } + } + } + // If Constants.REQUEST_TAG_KEY unspecified or no invoker be selected, downgrade to normal invokers + if (result.isEmpty()) { + // Only forceTag = true force match, otherwise downgrade + String forceTag = RpcContext.getContext().getAttachment(Constants.FORCE_USE_TAG); + if (StringUtils.isEmpty(forceTag) || "false".equals(forceTag)) { + for (Invoker invoker : invokers) { + if (StringUtils.isEmpty(invoker.getUrl().getParameter(Constants.TAG_KEY))) { + result.add(invoker); + } + } + } + } + return result; + } + +} diff --git a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/loadbalance/LoadBalanceTest.java b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/loadbalance/LoadBalanceTest.java index d231c63c3b2..088f781b94f 100644 --- a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/loadbalance/LoadBalanceTest.java +++ b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/loadbalance/LoadBalanceTest.java @@ -123,7 +123,7 @@ private AbstractLoadBalance getLoadBalance(String loadbalanceName) { @Test public void testRoundRobinLoadBalance_select() { - int runs = 10000; + int runs = 1000; Map counter = getInvokeCounter(runs, RoundRobinLoadBalance.NAME); for (Invoker minvoker : counter.keySet()) { Long count = counter.get(minvoker).get(); @@ -146,7 +146,7 @@ private void assertStrictWRRResult(int runs, Map resultMa public void testRoundRobinLoadBalanceWithWeight() { final Map totalMap = new HashMap(); final AtomicBoolean shouldBegin = new AtomicBoolean(false); - final int runs = 10000; + final int runs = 1000; List threads = new ArrayList(); int threadNum = 10; for (int i = 0; i < threadNum; i ++) { @@ -188,7 +188,7 @@ public void run() { @Test public void testRoundRobinLoadBalanceWithWeightShouldNotRecycle() { - int runs = 10000; + int runs = 1000; //tmperately add a new invoker weightInvokers.add(weightInvokerTmp); try { @@ -226,7 +226,7 @@ public void testRoundRobinLoadBalanceWithWeightShouldRecycle() { Assert.assertTrue("getField failed", true); } } - int runs = 10000; + int runs = 1000; //temporarily add a new invoker weightInvokers.add(weightInvokerTmp); try { @@ -249,7 +249,7 @@ public void testRoundRobinLoadBalanceWithWeightShouldRecycle() { public void testSelectByWeightLeastActive() { int sumInvoker1 = 0; int sumInvoker2 = 0; - int loop = 10000; + int loop = 1000; LeastActiveLoadBalance lb = new LeastActiveLoadBalance(); for (int i = 0; i < loop; i++) { Invoker selected = lb.select(weightInvokers, null, weightTestInvocation); @@ -273,7 +273,7 @@ public void testSelectByWeightRandom() { int sumInvoker1 = 0; int sumInvoker2 = 0; int sumInvoker3 = 0; - int loop = 10000; + int loop = 1000; RandomLoadBalance lb = new RandomLoadBalance(); for (int i = 0; i < loop; i++) { Invoker selected = lb.select(weightInvokers, null, weightTestInvocation); @@ -323,7 +323,7 @@ public void testRandomLoadBalance_select() { @Test public void testLeastActiveLoadBalance_select() { - int runs = 10000; + int runs = 1000; Map counter = getInvokeCounter(runs, LeastActiveLoadBalance.NAME); for (Invoker minvoker : counter.keySet()) { Long count = counter.get(minvoker).get(); diff --git a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/router/tag/TagRouterTest.java b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/router/tag/TagRouterTest.java new file mode 100644 index 00000000000..7b400b7174b --- /dev/null +++ b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/router/tag/TagRouterTest.java @@ -0,0 +1,153 @@ +/* + * 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 com.alibaba.dubbo.rpc.cluster.router.tag; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.common.extension.ExtensionLoader; +import com.alibaba.dubbo.common.utils.NetUtils; +import com.alibaba.dubbo.rpc.Invoker; +import com.alibaba.dubbo.rpc.RpcContext; +import com.alibaba.dubbo.rpc.RpcInvocation; +import com.alibaba.dubbo.rpc.cluster.Router; +import com.alibaba.dubbo.rpc.cluster.RouterFactory; +import com.alibaba.dubbo.rpc.cluster.router.MockInvoker; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class TagRouterTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @Before + public void setUp() throws Exception { + } + + @Test + public void testRoute_matchTag() { + RpcContext.getContext().setAttachment(Constants.TAG_KEY, "red"); + + List> invokers = new ArrayList>(); + Invoker redInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.1:20880/com.foo.BarService?dubbo.tag=red")); + Invoker yellowInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.2:20880/com.foo.BarService?dubbo.tag=yellow")); + Invoker blueInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.3:20880/com.foo.BarService?dubbo.tag=blue")); + Invoker defaultInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.4:20880/com.foo.BarService")); + + invokers.add(redInvoker); + invokers.add(yellowInvoker); + invokers.add(blueInvoker); + invokers.add(defaultInvoker); + + Router tagRouter = new TagRouter(); + List> filteredInvokers = tagRouter.route(invokers, URL.valueOf("consumer://" + NetUtils.getLocalHost() + "/com.foo.BarService"), new RpcInvocation()); + Assert.assertTrue(filteredInvokers.contains(redInvoker)); + Assert.assertFalse(filteredInvokers.contains(yellowInvoker)); + Assert.assertFalse(filteredInvokers.contains(blueInvoker)); + Assert.assertFalse(filteredInvokers.contains(defaultInvoker)); + } + + @Test + public void testRoute_matchDefault() { + + RpcContext.getContext().setAttachment(Constants.TAG_KEY, ""); + + List> invokers = new ArrayList>(); + Invoker redInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.1:20880/com.foo.BarService?dubbo.tag=red")); + Invoker yellowInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.2:20880/com.foo.BarService?dubbo.tag=yellow")); + Invoker blueInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.3:20880/com.foo.BarService?dubbo.tag=blue")); + Invoker defaultInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.4:20880/com.foo.BarService")); + + invokers.add(redInvoker); + invokers.add(yellowInvoker); + invokers.add(blueInvoker); + invokers.add(defaultInvoker); + + Router tagRouter = new TagRouter(); + List> filteredInvokers = tagRouter.route(invokers, URL.valueOf("consumer://" + NetUtils.getLocalHost() + "/com.foo.BarService"), new RpcInvocation()); + Assert.assertTrue(filteredInvokers.contains(defaultInvoker)); + Assert.assertFalse(filteredInvokers.contains(yellowInvoker)); + Assert.assertFalse(filteredInvokers.contains(blueInvoker)); + Assert.assertFalse(filteredInvokers.contains(redInvoker)); + } + + @Test + public void testRoute_requestWithTag_shouldDowngrade() { + + RpcContext.getContext().setAttachment(Constants.TAG_KEY, "black"); + + List> invokers = new ArrayList>(); + Invoker redInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.1:20880/com.foo.BarService?dubbo.tag=red")); + Invoker yellowInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.2:20880/com.foo.BarService?dubbo.tag=yellow")); + Invoker blueInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.3:20880/com.foo.BarService?dubbo.tag=blue")); + Invoker defaultInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.4:20880/com.foo.BarService")); + + invokers.add(redInvoker); + invokers.add(yellowInvoker); + invokers.add(blueInvoker); + invokers.add(defaultInvoker); + + Router tagRouter = new TagRouter(); + List> filteredInvokers = tagRouter.route(invokers, URL.valueOf("consumer://" + NetUtils.getLocalHost() + "/com.foo.BarService"), new RpcInvocation()); + Assert.assertTrue(filteredInvokers.contains(defaultInvoker)); + Assert.assertFalse(filteredInvokers.contains(yellowInvoker)); + Assert.assertFalse(filteredInvokers.contains(blueInvoker)); + Assert.assertFalse(filteredInvokers.contains(redInvoker)); + } + + @Test + public void testRoute_requestWithoutTag_shouldNotDowngrade() { + + RpcContext.getContext().setAttachment(Constants.TAG_KEY, ""); + + List> invokers = new ArrayList>(); + Invoker redInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.1:20880/com.foo.BarService?dubbo.tag=red")); + Invoker yellowInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.2:20880/com.foo.BarService?dubbo.tag=yellow")); + Invoker blueInvoker = new MockInvoker(URL.valueOf( + "dubbo://10.20.3.3:20880/com.foo.BarService?dubbo.tag=blue")); + + invokers.add(redInvoker); + invokers.add(yellowInvoker); + invokers.add(blueInvoker); + + Router tagRouter = new TagRouter(); + List> filteredInvokers = tagRouter.route(invokers, URL.valueOf("consumer://" + NetUtils.getLocalHost() + "/com.foo.BarService"), new RpcInvocation()); + Assert.assertEquals(0, filteredInvokers.size()); + } + +} diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java index 02d70ea809b..cedb20b688f 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java @@ -637,6 +637,10 @@ public class Constants { public static final String SERVICE_IMPL_CLASS = "service.classimpl"; + public static final String TAG_KEY = "dubbo.tag"; + + public static final String FORCE_USE_TAG = "dubbo.force.tag"; + /* * private Constants(){ } */ diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractServiceConfig.java index 68903988da4..7d242ff4c29 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractServiceConfig.java @@ -1,243 +1,255 @@ -/* - * 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 com.alibaba.dubbo.config; - -import com.alibaba.dubbo.common.Constants; -import com.alibaba.dubbo.config.support.Parameter; -import com.alibaba.dubbo.rpc.ExporterListener; - -import java.util.Arrays; -import java.util.List; - -/** - * AbstractServiceConfig - * - * @export - */ -public abstract class AbstractServiceConfig extends AbstractInterfaceConfig { - - private static final long serialVersionUID = 1L; - - // version - protected String version; - - // group - protected String group; - - // whether the service is deprecated - protected Boolean deprecated; - - // delay service exporting - protected Integer delay; - - // whether to export the service - protected Boolean export; - - // weight - protected Integer weight; - - // document center - protected String document; - - // whether to register as a dynamic service or not on register center - protected Boolean dynamic; - - // whether to use token - protected String token; - - // access log - protected String accesslog; - protected List protocols; - // max allowed execute times - private Integer executes; - // whether to register - private Boolean register; - - // warm up period - private Integer warmup; - - // serialization - private String serialization; - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - checkKey("version", version); - this.version = version; - } - - public String getGroup() { - return group; - } - - public void setGroup(String group) { - checkKey("group", group); - this.group = group; - } - - public Integer getDelay() { - return delay; - } - - public void setDelay(Integer delay) { - this.delay = delay; - } - - public Boolean getExport() { - return export; - } - - public void setExport(Boolean export) { - this.export = export; - } - - public Integer getWeight() { - return weight; - } - - public void setWeight(Integer weight) { - this.weight = weight; - } - - @Parameter(escaped = true) - public String getDocument() { - return document; - } - - public void setDocument(String document) { - this.document = document; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - checkName("token", token); - this.token = token; - } - - public void setToken(Boolean token) { - if (token == null) { - setToken((String) null); - } else { - setToken(String.valueOf(token)); - } - } - - public Boolean isDeprecated() { - return deprecated; - } - - public void setDeprecated(Boolean deprecated) { - this.deprecated = deprecated; - } - - public Boolean isDynamic() { - return dynamic; - } - - public void setDynamic(Boolean dynamic) { - this.dynamic = dynamic; - } - - public List getProtocols() { - return protocols; - } - - @SuppressWarnings({"unchecked"}) - public void setProtocols(List protocols) { - this.protocols = (List) protocols; - } - - public ProtocolConfig getProtocol() { - return protocols == null || protocols.isEmpty() ? null : protocols.get(0); - } - - public void setProtocol(ProtocolConfig protocol) { - this.protocols = Arrays.asList(protocol); - } - - public String getAccesslog() { - return accesslog; - } - - public void setAccesslog(String accesslog) { - this.accesslog = accesslog; - } - - public void setAccesslog(Boolean accesslog) { - if (accesslog == null) { - setAccesslog((String) null); - } else { - setAccesslog(String.valueOf(accesslog)); - } - } - - public Integer getExecutes() { - return executes; - } - - public void setExecutes(Integer executes) { - this.executes = executes; - } - - @Override - @Parameter(key = Constants.SERVICE_FILTER_KEY, append = true) - public String getFilter() { - return super.getFilter(); - } - - @Override - @Parameter(key = Constants.EXPORTER_LISTENER_KEY, append = true) - public String getListener() { - return listener; - } - - @Override - public void setListener(String listener) { - checkMultiExtension(ExporterListener.class, "listener", listener); - this.listener = listener; - } - - public Boolean isRegister() { - return register; - } - - public void setRegister(Boolean register) { - this.register = register; - } - - public Integer getWarmup() { - return warmup; - } - - public void setWarmup(Integer warmup) { - this.warmup = warmup; - } - - public String getSerialization() { - return serialization; - } - - public void setSerialization(String serialization) { - this.serialization = serialization; - } - -} +/* + * 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 com.alibaba.dubbo.config; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.config.support.Parameter; +import com.alibaba.dubbo.rpc.ExporterListener; + +import java.util.Arrays; +import java.util.List; + +/** + * AbstractServiceConfig + * + * @export + */ +public abstract class AbstractServiceConfig extends AbstractInterfaceConfig { + + private static final long serialVersionUID = 1L; + + // version + protected String version; + + // group + protected String group; + + // whether the service is deprecated + protected Boolean deprecated; + + // delay service exporting + protected Integer delay; + + // whether to export the service + protected Boolean export; + + // weight + protected Integer weight; + + // document center + protected String document; + + // whether to register as a dynamic service or not on register center + protected Boolean dynamic; + + // whether to use token + protected String token; + + // access log + protected String accesslog; + protected List protocols; + // max allowed execute times + private Integer executes; + // whether to register + private Boolean register; + + // warm up period + private Integer warmup; + + // serialization + private String serialization; + + // provider tag + protected String tag; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + checkKey("version", version); + this.version = version; + } + + public String getGroup() { + return group; + } + + public void setGroup(String group) { + checkKey("group", group); + this.group = group; + } + + public Integer getDelay() { + return delay; + } + + public void setDelay(Integer delay) { + this.delay = delay; + } + + public Boolean getExport() { + return export; + } + + public void setExport(Boolean export) { + this.export = export; + } + + public Integer getWeight() { + return weight; + } + + public void setWeight(Integer weight) { + this.weight = weight; + } + + @Parameter(escaped = true) + public String getDocument() { + return document; + } + + public void setDocument(String document) { + this.document = document; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + checkName("token", token); + this.token = token; + } + + public void setToken(Boolean token) { + if (token == null) { + setToken((String) null); + } else { + setToken(String.valueOf(token)); + } + } + + public Boolean isDeprecated() { + return deprecated; + } + + public void setDeprecated(Boolean deprecated) { + this.deprecated = deprecated; + } + + public Boolean isDynamic() { + return dynamic; + } + + public void setDynamic(Boolean dynamic) { + this.dynamic = dynamic; + } + + public List getProtocols() { + return protocols; + } + + @SuppressWarnings({"unchecked"}) + public void setProtocols(List protocols) { + this.protocols = (List) protocols; + } + + public ProtocolConfig getProtocol() { + return protocols == null || protocols.isEmpty() ? null : protocols.get(0); + } + + public void setProtocol(ProtocolConfig protocol) { + this.protocols = Arrays.asList(protocol); + } + + public String getAccesslog() { + return accesslog; + } + + public void setAccesslog(String accesslog) { + this.accesslog = accesslog; + } + + public void setAccesslog(Boolean accesslog) { + if (accesslog == null) { + setAccesslog((String) null); + } else { + setAccesslog(String.valueOf(accesslog)); + } + } + + public Integer getExecutes() { + return executes; + } + + public void setExecutes(Integer executes) { + this.executes = executes; + } + + @Override + @Parameter(key = Constants.SERVICE_FILTER_KEY, append = true) + public String getFilter() { + return super.getFilter(); + } + + @Override + @Parameter(key = Constants.EXPORTER_LISTENER_KEY, append = true) + public String getListener() { + return listener; + } + + @Override + public void setListener(String listener) { + checkMultiExtension(ExporterListener.class, "listener", listener); + this.listener = listener; + } + + public Boolean isRegister() { + return register; + } + + public void setRegister(Boolean register) { + this.register = register; + } + + public Integer getWarmup() { + return warmup; + } + + public void setWarmup(Integer warmup) { + this.warmup = warmup; + } + + public String getSerialization() { + return serialization; + } + + public void setSerialization(String serialization) { + this.serialization = serialization; + } + + @Parameter(key = "dubbo.tag") + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + +} diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java index 4d682273171..0f094f98076 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java @@ -120,4 +120,6 @@ String[] registry() default {}; + String tag() default ""; + } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java index 722c6d05213..84a01f8ea64 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java @@ -185,6 +185,9 @@ public Object postProcessAfterInitialization(Object bean, String beanName) } serviceConfig.setProtocols(protocolConfigs); } + if (service.tag().length() > 0) { + serviceConfig.setTag(service.tag()); + } try { serviceConfig.afterPropertiesSet(); } catch (RuntimeException e) { diff --git a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd index c48e2c3deab..ffa74ca3c5d 100644 --- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd +++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd @@ -312,6 +312,11 @@ + + + + + diff --git a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd index 40a7ac6c723..19361d69199 100644 --- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd +++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd @@ -312,6 +312,11 @@ + + + + + diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/integration/RegistryDirectory.java b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/integration/RegistryDirectory.java index 4bd0908a1ed..68ecc0e9efb 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/integration/RegistryDirectory.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/integration/RegistryDirectory.java @@ -445,7 +445,8 @@ private List> route(List> invokers, String method) { List routers = getRouters(); if (routers != null) { for (Router router : routers) { - if (router.getUrl() != null) { + // If router's url not null and is not route by runtime,we filter invokers here + if (router.getUrl() != null && !router.getUrl().getParameter(Constants.RUNTIME_KEY, false)) { invokers = router.route(invokers, getConsumerUrl(), invocation); } } diff --git a/dubbo-registry/dubbo-registry-default/src/test/java/com/alibaba/dubbo/registry/dubbo/RegistryDirectoryTest.java b/dubbo-registry/dubbo-registry-default/src/test/java/com/alibaba/dubbo/registry/dubbo/RegistryDirectoryTest.java index 3463407f928..fca493b0566 100644 --- a/dubbo-registry/dubbo-registry-default/src/test/java/com/alibaba/dubbo/registry/dubbo/RegistryDirectoryTest.java +++ b/dubbo-registry/dubbo-registry-default/src/test/java/com/alibaba/dubbo/registry/dubbo/RegistryDirectoryTest.java @@ -545,19 +545,19 @@ public void testNotifyRouterUrls() { registryDirectory.notify(serviceUrls); List routers = registryDirectory.getRouters(); //default invocation selector - Assert.assertEquals(1 + 1, routers.size()); + Assert.assertEquals(3, routers.size()); Assert.assertTrue(ScriptRouter.class == routers.get(1).getClass() || ScriptRouter.class == routers.get(0).getClass()); registryDirectory.notify(new ArrayList()); routers = registryDirectory.getRouters(); - Assert.assertEquals(1 + 1, routers.size()); + Assert.assertEquals(3, routers.size()); Assert.assertTrue(ScriptRouter.class == routers.get(1).getClass() || ScriptRouter.class == routers.get(0).getClass()); serviceUrls.clear(); serviceUrls.add(routerurl.addParameter(Constants.ROUTER_KEY, Constants.ROUTER_TYPE_CLEAR)); registryDirectory.notify(serviceUrls); routers = registryDirectory.getRouters(); - Assert.assertEquals(0 + 1, routers.size()); + Assert.assertEquals(2, routers.size()); } /** @@ -923,13 +923,13 @@ public void testNotifyRouterUrls_Clean() { serviceUrls.add(routerurl); registryDirectory.notify(serviceUrls); List routers = registryDirectory.getRouters(); - Assert.assertEquals(1 + 1, routers.size()); + Assert.assertEquals(3, routers.size()); serviceUrls.clear(); serviceUrls.add(routerurl.addParameter(Constants.ROUTER_KEY, Constants.ROUTER_TYPE_CLEAR)); registryDirectory.notify(serviceUrls); routers = registryDirectory.getRouters(); - Assert.assertEquals(0 + 1, routers.size()); + Assert.assertEquals(2, routers.size()); } /** diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java index dcedfcf6526..dbbf197ccf3 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java @@ -20,13 +20,12 @@ import com.alibaba.dubbo.common.Constants; import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.common.extension.ExtensionLoader; -import com.alibaba.dubbo.common.utils.ConfigUtils; +import com.alibaba.dubbo.common.logger.Logger; +import com.alibaba.dubbo.common.logger.LoggerFactory; import com.alibaba.dubbo.remoting.exchange.ExchangeClient; -import com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeServer; import com.alibaba.dubbo.rpc.Exporter; import com.alibaba.dubbo.rpc.ProxyFactory; import com.alibaba.dubbo.rpc.protocol.dubbo.support.ProtocolUtils; - import junit.framework.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -40,6 +39,9 @@ * Check available status for dubboInvoker */ public class DubboInvokerAvilableTest { + + private final static Logger logger = LoggerFactory.getLogger(DubboInvokerAvilableTest.class); + private static DubboProtocol protocol = DubboProtocol.getDubboProtocol(); private static ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); @@ -89,14 +91,15 @@ public void test_normal_channel_close_wait_gracefully() throws Exception { long start = System.currentTimeMillis(); - try{ + try { System.setProperty(Constants.SHUTDOWN_WAIT_KEY, "2000"); protocol.destroy(); - }finally { + } finally { System.getProperties().remove(Constants.SHUTDOWN_WAIT_KEY); } long waitTime = System.currentTimeMillis() - start; + logger.info("test_normal_channel_close_wait_gracefully wait for " + waitTime + " ms"); Assert.assertTrue(waitTime >= 2000); Assert.assertEquals(false, invoker.isAvailable()); From 7fbfc37e58b2457334528d00dbcf2f06311b67a5 Mon Sep 17 00:00:00 2001 From: cvictory Date: Thu, 24 Jan 2019 20:22:58 +0800 Subject: [PATCH 20/23] Merge pull request #3315, fixes #2842, duplicate SPI config items. --- all/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/all/pom.xml b/all/pom.xml index 519028d07c0..a54b84db093 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -535,6 +535,18 @@ + + + com.alibaba:dubbo + + + com/** + org/** + + META-INF/dubbo/** + + + From 43d8620cee20eaa7a9f1194f6f2f2650367673c7 Mon Sep 17 00:00:00 2001 From: Yuhao Bi Date: Mon, 28 Jan 2019 17:04:07 +0800 Subject: [PATCH 21/23] Fix random ut falling in DubboMonitorTest (#3336) --- .../dubbo/monitor/dubbo/DubboMonitorTest.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/dubbo-monitor/dubbo-monitor-default/src/test/java/com/alibaba/dubbo/monitor/dubbo/DubboMonitorTest.java b/dubbo-monitor/dubbo-monitor-default/src/test/java/com/alibaba/dubbo/monitor/dubbo/DubboMonitorTest.java index 8d5ec578cbd..d2a0e2978ca 100644 --- a/dubbo-monitor/dubbo-monitor-default/src/test/java/com/alibaba/dubbo/monitor/dubbo/DubboMonitorTest.java +++ b/dubbo-monitor/dubbo-monitor-default/src/test/java/com/alibaba/dubbo/monitor/dubbo/DubboMonitorTest.java @@ -103,22 +103,23 @@ public void testCount() throws Exception { .addParameter(MonitorService.CONCURRENT, 1) .addParameter(MonitorService.MAX_CONCURRENT, 1); monitor.collect(statistics); + monitor.send(); while (lastStatistics == null) { Thread.sleep(10); } - Assert.assertEquals(lastStatistics.getParameter(MonitorService.APPLICATION), "morgan"); - Assert.assertEquals(lastStatistics.getProtocol(), "dubbo"); - Assert.assertEquals(lastStatistics.getHost(), "10.20.153.10"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.APPLICATION), "morgan"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.INTERFACE), "MemberService"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.METHOD), "findPerson"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.CONSUMER), "10.20.153.11"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.SUCCESS), "1"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.FAILURE), "0"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.ELAPSED), "3"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.MAX_ELAPSED), "3"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.CONCURRENT), "1"); - Assert.assertEquals(lastStatistics.getParameter(MonitorService.MAX_CONCURRENT), "1"); + Assert.assertEquals("morgan", lastStatistics.getParameter(MonitorService.APPLICATION)); + Assert.assertEquals("dubbo", lastStatistics.getProtocol()); + Assert.assertEquals("10.20.153.10", lastStatistics.getHost()); + Assert.assertEquals("morgan", lastStatistics.getParameter(MonitorService.APPLICATION)); + Assert.assertEquals("MemberService", lastStatistics.getParameter(MonitorService.INTERFACE)); + Assert.assertEquals("findPerson", lastStatistics.getParameter(MonitorService.METHOD)); + Assert.assertEquals("10.20.153.11", lastStatistics.getParameter(MonitorService.CONSUMER)); + Assert.assertEquals("1", lastStatistics.getParameter(MonitorService.SUCCESS)); + Assert.assertEquals("0", lastStatistics.getParameter(MonitorService.FAILURE)); + Assert.assertEquals("3", lastStatistics.getParameter(MonitorService.ELAPSED)); + Assert.assertEquals("3", lastStatistics.getParameter(MonitorService.MAX_ELAPSED)); + Assert.assertEquals("1", lastStatistics.getParameter(MonitorService.CONCURRENT)); + Assert.assertEquals("1", lastStatistics.getParameter(MonitorService.MAX_CONCURRENT)); monitor.destroy(); } From 19f30941f2b14c7df1a989b9c115c75c5667cdd9 Mon Sep 17 00:00:00 2001 From: min Date: Mon, 28 Jan 2019 17:48:11 +0800 Subject: [PATCH 22/23] use netty4 as default transporter for 2.6.6 #3029 (#3318) * use netty4 as default transporter for 2.6.6 #3029 * fix config file issue && enhance UT * ignore unstable test --- dependencies-bom/pom.xml | 2 +- dubbo-config/dubbo-config-api/pom.xml | 2 +- dubbo-config/dubbo-config-spring/pom.xml | 2 +- dubbo-demo/dubbo-demo-consumer/pom.xml | 2 +- dubbo-demo/dubbo-demo-provider/pom.xml | 2 +- dubbo-monitor/dubbo-monitor-default/pom.xml | 2 +- dubbo-registry/dubbo-registry-default/pom.xml | 2 +- .../remoting/transport/netty/NettyTransporter.java | 2 +- .../com.alibaba.dubbo.remoting.Transporter | 2 +- .../support/header/HeartbeatHandlerTest.java | 6 +++--- .../transport/netty/ClientReconnectTest.java | 6 +++--- .../remoting/transport/netty/ClientsTest.java | 2 +- .../remoting/transport/netty/NettyClientTest.java | 8 ++++---- .../transport/netty/NettyClientToServerTest.java | 4 ++-- .../remoting/transport/netty/NettyStringTest.java | 4 ++-- .../transport/netty4/NettyClientHandler.java | 14 ++++++++++++++ .../transport/netty4/NettyTransporter.java | 2 +- .../com.alibaba.dubbo.remoting.Transporter | 3 ++- .../transport/netty4/NettyClientToServerTest.java | 13 ++++++++++--- dubbo-remoting/dubbo-remoting-p2p/pom.xml | 6 ++++++ dubbo-rpc/dubbo-rpc-dubbo/pom.xml | 6 +++--- .../protocol/dubbo/DubboInvokerAvilableTest.java | 5 +++-- dubbo-rpc/dubbo-rpc-thrift/pom.xml | 2 +- 23 files changed, 64 insertions(+), 35 deletions(-) diff --git a/dependencies-bom/pom.xml b/dependencies-bom/pom.xml index 6628d90576a..0e037d6e3b8 100644 --- a/dependencies-bom/pom.xml +++ b/dependencies-bom/pom.xml @@ -75,7 +75,7 @@ 4.3.16.RELEASE 3.20.0-GA 3.2.5.Final - 4.0.35.Final + 4.1.25.Final 1.1.7 2.1.4 4.5.3 diff --git a/dubbo-config/dubbo-config-api/pom.xml b/dubbo-config/dubbo-config-api/pom.xml index 1acfb5c340b..2d09ca71441 100644 --- a/dubbo-config/dubbo-config-api/pom.xml +++ b/dubbo-config/dubbo-config-api/pom.xml @@ -85,7 +85,7 @@ com.alibaba - dubbo-remoting-netty + dubbo-remoting-netty4 ${project.parent.version} test diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml index 420140257a5..f2c29c3d7ff 100644 --- a/dubbo-config/dubbo-config-spring/pom.xml +++ b/dubbo-config/dubbo-config-spring/pom.xml @@ -86,7 +86,7 @@ com.alibaba - dubbo-remoting-netty + dubbo-remoting-netty4 ${project.parent.version} test diff --git a/dubbo-demo/dubbo-demo-consumer/pom.xml b/dubbo-demo/dubbo-demo-consumer/pom.xml index d43d6fc0eaf..20d24b72589 100644 --- a/dubbo-demo/dubbo-demo-consumer/pom.xml +++ b/dubbo-demo/dubbo-demo-consumer/pom.xml @@ -52,7 +52,7 @@ com.alibaba - dubbo-remoting-netty + dubbo-remoting-netty4 com.alibaba diff --git a/dubbo-demo/dubbo-demo-provider/pom.xml b/dubbo-demo/dubbo-demo-provider/pom.xml index f6bb48bb0ed..53bc8278cf6 100644 --- a/dubbo-demo/dubbo-demo-provider/pom.xml +++ b/dubbo-demo/dubbo-demo-provider/pom.xml @@ -53,7 +53,7 @@ com.alibaba - dubbo-remoting-netty + dubbo-remoting-netty4 com.alibaba diff --git a/dubbo-monitor/dubbo-monitor-default/pom.xml b/dubbo-monitor/dubbo-monitor-default/pom.xml index b1d3c53cf97..f8175be69e2 100644 --- a/dubbo-monitor/dubbo-monitor-default/pom.xml +++ b/dubbo-monitor/dubbo-monitor-default/pom.xml @@ -42,7 +42,7 @@ com.alibaba - dubbo-remoting-netty + dubbo-remoting-netty4 ${project.parent.version} test diff --git a/dubbo-registry/dubbo-registry-default/pom.xml b/dubbo-registry/dubbo-registry-default/pom.xml index 2de38840de6..606d56a2165 100644 --- a/dubbo-registry/dubbo-registry-default/pom.xml +++ b/dubbo-registry/dubbo-registry-default/pom.xml @@ -49,7 +49,7 @@ com.alibaba - dubbo-remoting-netty + dubbo-remoting-netty4 ${project.parent.version} test diff --git a/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyTransporter.java b/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyTransporter.java index bbe0e96cf0b..cbbf9f390f4 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyTransporter.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyTransporter.java @@ -25,7 +25,7 @@ public class NettyTransporter implements Transporter { - public static final String NAME = "netty"; + public static final String NAME = "netty3"; @Override public Server bind(URL url, ChannelHandler listener) throws RemotingException { diff --git a/dubbo-remoting/dubbo-remoting-netty/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.remoting.Transporter b/dubbo-remoting/dubbo-remoting-netty/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.remoting.Transporter index eb9bcb28824..f10f0a837fe 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.remoting.Transporter +++ b/dubbo-remoting/dubbo-remoting-netty/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.remoting.Transporter @@ -1 +1 @@ -netty=com.alibaba.dubbo.remoting.transport.netty.NettyTransporter \ No newline at end of file +netty3=com.alibaba.dubbo.remoting.transport.netty.NettyTransporter diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java index 89fc6f44b56..b8f7218a08f 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java @@ -56,7 +56,7 @@ public void after() throws Exception { @Test public void testServerHeartbeat() throws Exception { - URL serverURL = URL.valueOf("header://localhost:55555"); + URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty3"); serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000); TestHeartbeatHandler handler = new TestHeartbeatHandler(); server = Exchangers.bind(serverURL, handler); @@ -72,7 +72,7 @@ public void testServerHeartbeat() throws Exception { @Test public void testHeartbeat() throws Exception { - URL serverURL = URL.valueOf("header://localhost:55555"); + URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty3"); serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000); TestHeartbeatHandler handler = new TestHeartbeatHandler(); server = Exchangers.bind(serverURL, handler); @@ -89,7 +89,7 @@ public void testHeartbeat() throws Exception { @Test public void testClientHeartbeat() throws Exception { FakeChannelHandlers.setTestingChannelHandlers(); - URL serverURL = URL.valueOf("header://localhost:55555"); + URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty3"); TestHeartbeatHandler handler = new TestHeartbeatHandler(); server = Exchangers.bind(serverURL, handler); System.out.println("Server bind successfully"); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ClientReconnectTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ClientReconnectTest.java index f22ab11b1db..1f1107e3f01 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ClientReconnectTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ClientReconnectTest.java @@ -80,7 +80,7 @@ public void testReconnect() throws RemotingException, InterruptedException { public void testReconnectWarnLog() throws RemotingException, InterruptedException { int port = NetUtils.getAvailablePort(); DubboAppender.doStart(); - String url = "exchange://127.0.0.2:" + port + "/client.reconnect.test?check=false&" + String url = "exchange://127.0.0.2:" + port + "/client.reconnect.test?check=false&client=netty3&" + Constants.RECONNECT_KEY + "=" + 1; //1ms reconnect, ensure that there is enough frequency to reconnect try { Exchangers.connect(url); @@ -97,12 +97,12 @@ public void testReconnectWarnLog() throws RemotingException, InterruptedExceptio } public Client startClient(int port, int reconnectPeriod) throws RemotingException { - final String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test?check=false&" + Constants.RECONNECT_KEY + "=" + reconnectPeriod; + final String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test?check=false&client=netty3&" + Constants.RECONNECT_KEY + "=" + reconnectPeriod; return Exchangers.connect(url); } public Server startServer(int port) throws RemotingException { - final String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test"; + final String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test?server=netty3"; return Exchangers.bind(url, new HandlerAdapter()); } diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ClientsTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ClientsTest.java index 3a6a3beaab3..cd0044caff9 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ClientsTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ClientsTest.java @@ -47,7 +47,7 @@ public void testGetTransportNull() { @Test public void testGetTransport3() { - String name = "netty"; + String name = "netty3"; assertEquals(NettyTransporter.class, ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass()); } diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientTest.java index 5e47ea5ae18..307bc341859 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientTest.java @@ -39,7 +39,7 @@ public class NettyClientTest { @BeforeClass public static void setUp() throws Exception { - server = Exchangers.bind(URL.valueOf("exchange://localhost:10001?server=netty"), new TelnetServerHandler()); + server = Exchangers.bind(URL.valueOf("exchange://localhost:10001?server=netty3"), new TelnetServerHandler()); } @AfterClass @@ -52,7 +52,7 @@ public static void tearDown() throws Exception { } public static void main(String[] args) throws RemotingException, InterruptedException { - ExchangeChannel client = Exchangers.connect(URL.valueOf("exchange://10.20.153.10:20880?client=netty&heartbeat=1000")); + ExchangeChannel client = Exchangers.connect(URL.valueOf("exchange://10.20.153.10:20880?client=netty3&heartbeat=1000")); Thread.sleep(60 * 1000 * 50); } @@ -60,7 +60,7 @@ public static void main(String[] args) throws RemotingException, InterruptedExce public void testClientClose() throws Exception { List clients = new ArrayList(100); for (int i = 0; i < 100; i++) { - ExchangeChannel client = Exchangers.connect(URL.valueOf("exchange://localhost:10001?client=netty")); + ExchangeChannel client = Exchangers.connect(URL.valueOf("exchange://localhost:10001?client=netty3")); Thread.sleep(5); clients.add(client); } @@ -73,7 +73,7 @@ public void testClientClose() throws Exception { @Test public void testServerClose() throws Exception { for (int i = 0; i < 100; i++) { - Server aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + (5000 + i) + "?client=netty"), new TelnetServerHandler()); + Server aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + (5000 + i) + "?server=netty3"), new TelnetServerHandler()); aServer.close(); } } diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientToServerTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientToServerTest.java index 823b3709e9a..57f720406df 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientToServerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientToServerTest.java @@ -29,11 +29,11 @@ public class NettyClientToServerTest extends ClientToServerTest { protected ExchangeServer newServer(int port, Replier receiver) throws RemotingException { - return Exchangers.bind(URL.valueOf("exchange://localhost:" + port + "?server=netty"), receiver); + return Exchangers.bind(URL.valueOf("exchange://localhost:" + port + "?server=netty3"), receiver); } protected ExchangeChannel newClient(int port) throws RemotingException { - return Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty&timeout=3000")); + return Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty3&timeout=3000")); } } \ No newline at end of file diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyStringTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyStringTest.java index 1b1edfc117e..5813164bb32 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyStringTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyStringTest.java @@ -38,8 +38,8 @@ public static void setUp() throws Exception { //int port = (int) (1000 * Math.random() + 10000); int port = 10001; System.out.println(port); - server = Exchangers.bind(URL.valueOf("telnet://0.0.0.0:" + port + "?server=netty"), new TelnetServerHandler()); - client = Exchangers.connect(URL.valueOf("telnet://127.0.0.1:" + port + "?client=netty"), new TelnetClientHandler()); + server = Exchangers.bind(URL.valueOf("telnet://0.0.0.0:" + port + "?server=netty3"), new TelnetServerHandler()); + client = Exchangers.connect(URL.valueOf("telnet://127.0.0.1:" + port + "?client=netty3"), new TelnetClientHandler()); } @AfterClass diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClientHandler.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClientHandler.java index f75d7028dd5..179e48af770 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClientHandler.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClientHandler.java @@ -17,8 +17,11 @@ package com.alibaba.dubbo.remoting.transport.netty4; import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.common.utils.StringUtils; import com.alibaba.dubbo.remoting.ChannelHandler; +import com.alibaba.dubbo.remoting.exchange.Request; +import com.alibaba.dubbo.remoting.exchange.Response; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; @@ -82,7 +85,18 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) super.write(ctx, msg, promise); NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(), url, handler); try { + // if error happens from write, mock a BAD_REQUEST response so that invoker can return immediately without + // waiting until timeout. FIXME: not sure if this is the right approach, but exceptionCaught doesn't work + // as expected. + if (promise.cause() != null && msg instanceof Request) { + Request request = (Request) msg; + Response response = new Response(request.getId(), request.getVersion()); + response.setStatus(Response.BAD_REQUEST); + response.setErrorMessage(StringUtils.toString(promise.cause())); + handler.received(channel, response); + } else { handler.sent(channel, msg); + } } finally { NettyChannel.removeChannelIfDisconnected(ctx.channel()); } diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyTransporter.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyTransporter.java index 1a1f4bc7f75..b8e0d4901dd 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyTransporter.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyTransporter.java @@ -25,7 +25,7 @@ public class NettyTransporter implements Transporter { - public static final String NAME = "netty4"; + public static final String NAME = "netty"; @Override public Server bind(URL url, ChannelHandler listener) throws RemotingException { diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.remoting.Transporter b/dubbo-remoting/dubbo-remoting-netty4/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.remoting.Transporter index fbdb0340ddf..7d7ed21c1c6 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.remoting.Transporter +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.remoting.Transporter @@ -1 +1,2 @@ -netty4=com.alibaba.dubbo.remoting.transport.netty4.NettyTransporter \ No newline at end of file +netty4=com.alibaba.dubbo.remoting.transport.netty4.NettyTransporter +netty=com.alibaba.dubbo.remoting.transport.netty4.NettyTransporter diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClientToServerTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClientToServerTest.java index 2c7ada22eae..577f838dd83 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClientToServerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClientToServerTest.java @@ -16,6 +16,7 @@ */ package com.alibaba.dubbo.remoting.transport.netty4; +import com.alibaba.dubbo.common.Constants; import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.remoting.RemotingException; import com.alibaba.dubbo.remoting.exchange.ExchangeChannel; @@ -29,11 +30,17 @@ public class NettyClientToServerTest extends ClientToServerTest { protected ExchangeServer newServer(int port, Replier receiver) throws RemotingException { - return Exchangers.bind(URL.valueOf("exchange://localhost:" + port + "?server=netty4"), receiver); + // add heartbeat cycle to avoid unstable ut. + URL url = URL.valueOf("exchange://localhost:" + port + "?server=netty4"); + url = url.addParameter(Constants.HEARTBEAT_KEY, 600 * 1000); + return Exchangers.bind(url, receiver); } protected ExchangeChannel newClient(int port) throws RemotingException { - return Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty4")); + // add heartbeat cycle to avoid unstable ut. + URL url = URL.valueOf("exchange://localhost:" + port + "?client=netty4&timeout=3000"); + url = url.addParameter(Constants.HEARTBEAT_KEY, 600 * 1000); + return Exchangers.connect(url); } -} \ No newline at end of file +} diff --git a/dubbo-remoting/dubbo-remoting-p2p/pom.xml b/dubbo-remoting/dubbo-remoting-p2p/pom.xml index f7133d44581..56f5662f25e 100644 --- a/dubbo-remoting/dubbo-remoting-p2p/pom.xml +++ b/dubbo-remoting/dubbo-remoting-p2p/pom.xml @@ -34,5 +34,11 @@ dubbo-remoting-api ${project.parent.version} + + com.alibaba + dubbo-remoting-netty4 + ${project.parent.version} + test + \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml index 5f9d62c202e..4a628058079 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml +++ b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml @@ -52,7 +52,7 @@ com.alibaba - dubbo-remoting-netty + dubbo-remoting-netty4 ${project.parent.version} test @@ -63,8 +63,8 @@ test - org.apache.mina - mina-core + io.netty + netty-all test diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java index dbbf197ccf3..8d33733f248 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java @@ -29,6 +29,7 @@ import junit.framework.Assert; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import java.lang.reflect.Field; @@ -80,7 +81,7 @@ public void test_Normal_ChannelReadOnly() throws Exception { getClients(invoker)[0].removeAttribute(Constants.CHANNEL_ATTRIBUTE_READONLY_KEY); } - @Test + @Ignore public void test_normal_channel_close_wait_gracefully() throws Exception { URL url = URL.valueOf("dubbo://127.0.0.1:20883/hi?scope=true&lazy=false"); @@ -165,4 +166,4 @@ public String get() { return "ok"; } } -} \ No newline at end of file +} diff --git a/dubbo-rpc/dubbo-rpc-thrift/pom.xml b/dubbo-rpc/dubbo-rpc-thrift/pom.xml index ed73b9e74d4..f98ba99099b 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/pom.xml +++ b/dubbo-rpc/dubbo-rpc-thrift/pom.xml @@ -46,7 +46,7 @@ com.alibaba - dubbo-remoting-netty + dubbo-remoting-netty4 ${project.parent.version} From 342e814296b08b3383bd0815978f3ad9389c0586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=B0=8F=E4=B8=9C?= <30755351+dongYES@users.noreply.github.com> Date: Fri, 1 Feb 2019 15:42:14 +0800 Subject: [PATCH 23/23] Activate SPI sort (#3412) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修正排序 * Update dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.java code style Co-Authored-By: dongYES <30755351+dongYES@users.noreply.github.com> --- .../extension/support/ActivateComparator.java | 180 +++++++++--------- 1 file changed, 94 insertions(+), 86 deletions(-) diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.java index 7cf7a1b3716..1386efa6aed 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.java @@ -1,86 +1,94 @@ -/* - * 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 com.alibaba.dubbo.common.extension.support; - -import com.alibaba.dubbo.common.extension.Activate; -import com.alibaba.dubbo.common.extension.ExtensionLoader; -import com.alibaba.dubbo.common.extension.SPI; - -import java.util.Comparator; - -/** - * OrderComparetor - */ -public class ActivateComparator implements Comparator { - - public static final Comparator COMPARATOR = new ActivateComparator(); - - @Override - public int compare(Object o1, Object o2) { - if (o1 == null && o2 == null) { - return 0; - } - if (o1 == null) { - return -1; - } - if (o2 == null) { - return 1; - } - if (o1.equals(o2)) { - return 0; - } - Activate a1 = o1.getClass().getAnnotation(Activate.class); - Activate a2 = o2.getClass().getAnnotation(Activate.class); - if ((a1.before().length > 0 || a1.after().length > 0 - || a2.before().length > 0 || a2.after().length > 0) - && o1.getClass().getInterfaces().length > 0 - && o1.getClass().getInterfaces()[0].isAnnotationPresent(SPI.class)) { - ExtensionLoader extensionLoader = ExtensionLoader.getExtensionLoader(o1.getClass().getInterfaces()[0]); - if (a1.before().length > 0 || a1.after().length > 0) { - String n2 = extensionLoader.getExtensionName(o2.getClass()); - for (String before : a1.before()) { - if (before.equals(n2)) { - return -1; - } - } - for (String after : a1.after()) { - if (after.equals(n2)) { - return 1; - } - } - } - if (a2.before().length > 0 || a2.after().length > 0) { - String n1 = extensionLoader.getExtensionName(o1.getClass()); - for (String before : a2.before()) { - if (before.equals(n1)) { - return 1; - } - } - for (String after : a2.after()) { - if (after.equals(n1)) { - return -1; - } - } - } - } - int n1 = a1 == null ? 0 : a1.order(); - int n2 = a2 == null ? 0 : a2.order(); - // never return 0 even if n1 equals n2, otherwise, o1 and o2 will override each other in collection like HashSet - return n1 > n2 ? 1 : -1; - } - -} +/* + * 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 com.alibaba.dubbo.common.extension.support; + +import com.alibaba.dubbo.common.extension.Activate; +import com.alibaba.dubbo.common.extension.ExtensionLoader; +import com.alibaba.dubbo.common.extension.SPI; + +import java.util.Comparator; + +/** + * OrderComparetor + */ +public class ActivateComparator implements Comparator { + + public static final Comparator COMPARATOR = new ActivateComparator(); + + @Override + public int compare(Object o1, Object o2) { + if (o1 == null && o2 == null) { + return 0; + } + if (o1 == null) { + return -1; + } + if (o2 == null) { + return 1; + } + if (o1.equals(o2)) { + return 0; + } + Activate a1 = o1.getClass().getAnnotation(Activate.class); + Activate a2 = o2.getClass().getAnnotation(Activate.class); + Class spiClass = null; + if (o1.getClass().getInterfaces().length > 0) { + for (Class item : o1.getClass().getInterfaces()) { + if (item.isAnnotationPresent(SPI.class)) { + spiClass = item; + break; + } + } + } + if ((a1.before().length > 0 || a1.after().length > 0 + || a2.before().length > 0 || a2.after().length > 0) + && spiClass != null) { + ExtensionLoader extensionLoader = ExtensionLoader.getExtensionLoader(spiClass); + if (a1.before().length > 0 || a1.after().length > 0) { + String n2 = extensionLoader.getExtensionName(o2.getClass()); + for (String before : a1.before()) { + if (before.equals(n2)) { + return -1; + } + } + for (String after : a1.after()) { + if (after.equals(n2)) { + return 1; + } + } + } + if (a2.before().length > 0 || a2.after().length > 0) { + String n1 = extensionLoader.getExtensionName(o1.getClass()); + for (String before : a2.before()) { + if (before.equals(n1)) { + return 1; + } + } + for (String after : a2.after()) { + if (after.equals(n1)) { + return -1; + } + } + } + } + int n1 = a1 == null ? 0 : a1.order(); + int n2 = a2 == null ? 0 : a2.order(); + // never return 0 even if n1 equals n2, otherwise, o1 and o2 will override each other in collection like HashSet + return n1 > n2 ? 1 : -1; + } + +}