diff --git a/CHANGES.md b/CHANGES.md
index 23d4aba9a97..9bb673a9c6d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,5 +1,37 @@
# Release Notes
+## 2.6.5
+
+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. [#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)
+- [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:
+
+- @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)
+- 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 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
Enhancements / Features
@@ -83,4 +115,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/all/pom.xml b/all/pom.xml
index 39884493871..a54b84db093 100644
--- a/all/pom.xml
+++ b/all/pom.xml
@@ -19,11 +19,11 @@
com.alibaba
dubbo-parent
- 2.6.5-SNAPSHOT
+ 2.6.6-SNAPSHOT
../pom.xml
dubbo
- 2.6.5-SNAPSHOT
+ 2.6.6-SNAPSHOT
jar
dubbo-all
The all in one project of dubbo
@@ -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
@@ -543,6 +535,18 @@
+
+
+ com.alibaba:dubbo
+
+
+ com/**
+ org/**
+
+ META-INF/dubbo/**
+
+
+
@@ -588,4 +592,4 @@
-
\ No newline at end of file
+
diff --git a/bom/pom.xml b/bom/pom.xml
index 165964f6e29..d8d2729652a 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -14,7 +14,7 @@
com.alibaba
dubbo-bom
- 2.6.5-SNAPSHOT
+ 2.6.6-SNAPSHOT
pom
dubbo-bom
diff --git a/dependencies-bom/pom.xml b/dependencies-bom/pom.xml
index 8da6b978125..0e037d6e3b8 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.6-SNAPSHOT
pom
dubbo-dependencies-bom
@@ -76,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/distribution/pom.xml b/distribution/pom.xml
index ffdd3cffc25..9b6d55ed01e 100644
--- a/distribution/pom.xml
+++ b/distribution/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-parent
- 2.6.5-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-distribution
pom
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-cluster/pom.xml b/dubbo-cluster/pom.xml
index d125ec35f56..3f7b223ecbd 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.6-SNAPSHOT
dubbo-cluster
jar
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/pom.xml b/dubbo-common/pom.xml
index 742daa91793..b75de81e1cf 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.6-SNAPSHOT
dubbo-common
jar
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-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
com.alibaba
- dubbo-remoting-netty
+ dubbo-remoting-netty4
${project.parent.version}
test
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 f9b9029f5bb..90279dbf48e 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();
@@ -464,7 +464,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())) {
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..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;
}
@@ -127,8 +140,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 +187,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/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 extends ProtocolConfig> 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 extends ProtocolConfig> 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/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-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 a1d382e468d..adcff42a4c4 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
@@ -277,7 +277,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 268a0c41476..3f971dfa218 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
@@ -311,7 +311,8 @@ protected synchronized void doExport() {
checkRegistry();
checkProtocol();
appendProperties(this);
- checkStubAndMock(interfaceClass);
+ checkStub(interfaceClass);
+ checkMock(interfaceClass);
if (path == null || path.length() == 0) {
path = interfaceName;
}
@@ -820,6 +821,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/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 752130341e1..e6d0b09819f 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
@@ -1,125 +1,127 @@
-/*
- * 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Service
- *
- * @export
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-@Inherited
-public @interface Service {
-
- Class> interfaceClass() default void.class;
-
- String interfaceName() default "";
-
- String version() default "";
-
- String group() default "";
-
- String path() default "";
-
- boolean export() default false;
-
- String token() default "";
-
- boolean deprecated() default false;
-
- boolean dynamic() default false;
-
- String accesslog() default "";
-
- int executes() default 0;
-
- boolean register() default true;
-
- int weight() default 0;
-
- String document() default "";
-
- int delay() default 0;
-
- String local() default "";
-
- String stub() default "";
-
- String cluster() default "";
-
- String proxy() default "";
-
- int connections() default 0;
-
- int callbacks() default 0;
-
- String onconnect() default "";
-
- String ondisconnect() default "";
-
- String owner() default "";
-
- String layer() default "";
-
- int retries() default 0;
-
- String loadbalance() default "";
-
- boolean async() default false;
-
- int actives() default 0;
-
- boolean sent() default false;
-
- String mock() default "";
-
- String validation() default "";
-
- int timeout() default 0;
-
- String cache() default "";
-
- String[] filter() default {};
-
- String[] listener() default {};
-
- String[] parameters() default {};
-
- String application() default "";
-
- String module() default "";
-
- String provider() default "";
-
- String[] protocol() default {};
-
- String monitor() default "";
-
- String[] registry() default {};
-
- Method[] methods() default {};
-
-}
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Service
+ *
+ * @export
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE})
+@Inherited
+public @interface Service {
+
+ Class> interfaceClass() default void.class;
+
+ String interfaceName() default "";
+
+ String version() default "";
+
+ String group() default "";
+
+ String path() default "";
+
+ boolean export() default false;
+
+ String token() default "";
+
+ boolean deprecated() default false;
+
+ boolean dynamic() default false;
+
+ String accesslog() default "";
+
+ int executes() default 0;
+
+ boolean register() default true;
+
+ int weight() default 0;
+
+ String document() default "";
+
+ int delay() default 0;
+
+ String local() default "";
+
+ String stub() default "";
+
+ String cluster() default "";
+
+ String proxy() default "";
+
+ int connections() default 0;
+
+ int callbacks() default 0;
+
+ String onconnect() default "";
+
+ String ondisconnect() default "";
+
+ String owner() default "";
+
+ String layer() default "";
+
+ int retries() default 0;
+
+ String loadbalance() default "";
+
+ boolean async() default false;
+
+ int actives() default 0;
+
+ boolean sent() default false;
+
+ String mock() default "";
+
+ String validation() default "";
+
+ int timeout() default 0;
+
+ String cache() default "";
+
+ String[] filter() default {};
+
+ String[] listener() default {};
+
+ String[] parameters() default {};
+
+ String application() default "";
+
+ String module() default "";
+
+ String provider() default "";
+
+ String[] protocol() default {};
+
+ String monitor() default "";
+
+ String[] registry() default {};
+
+ String tag() default "";
+
+ Method[] methods() default {};
+
+}
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 c0f5a6b3d52..af29bb72b72 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-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-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();
diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml
index 7697f6fc934..f2c29c3d7ff 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.6-SNAPSHOT
dubbo-config-spring
jar
@@ -35,11 +34,6 @@
dubbo-config-api
${project.parent.version}
-
- com.alibaba
- dubbo-bootstrap
- ${project.parent.version}
-
org.springframework
spring-beans
@@ -92,7 +86,7 @@
com.alibaba
- dubbo-remoting-netty
+ dubbo-remoting-netty4
${project.parent.version}
test
@@ -167,4 +161,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..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
@@ -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
@@ -186,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/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/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 780db197b25..bd09fb04804 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
@@ -371,7 +371,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));
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/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);
}
}
}
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/compat/dubbo.xsd b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd
index 2dbdde18e54..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
@@ -101,6 +101,11 @@
+
+
+
+
+
@@ -307,6 +312,11 @@
+
+
+
+
+
@@ -480,6 +490,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..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
@@ -101,6 +101,11 @@
+
+
+
+
+
@@ -307,6 +312,11 @@
+
+
+
+
+
@@ -480,6 +490,11 @@
+
+
+
+
+
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/ConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
index 2415de4f8f7..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() {
@@ -148,6 +166,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");
@@ -986,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
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-config/pom.xml b/dubbo-config/pom.xml
index 85e5cd70037..ac26e99254a 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.6-SNAPSHOT
dubbo-config
pom
diff --git a/dubbo-container/dubbo-container-api/pom.xml b/dubbo-container/dubbo-container-api/pom.xml
index b0169610d87..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-SNAPSHOT
+ 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 c1fc490289f..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-SNAPSHOT
+ 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 ff955274981..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-SNAPSHOT
+ 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 0af93dcbf45..580ee04b03d 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.6-SNAPSHOT
dubbo-container-spring
jar
@@ -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/dubbo-container/pom.xml b/dubbo-container/pom.xml
index a12f88ab480..3f7d91a3957 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.6-SNAPSHOT
dubbo-container
pom
diff --git a/dubbo-demo/dubbo-demo-api/pom.xml b/dubbo-demo/dubbo-demo-api/pom.xml
index 14a10b185f4..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-SNAPSHOT
+ 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 d10969dbccd..20d24b72589 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.6-SNAPSHOT
dubbo-demo-consumer
jar
@@ -52,7 +52,7 @@
com.alibaba
- dubbo-remoting-netty
+ dubbo-remoting-netty4
com.alibaba
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();
}
-
-
}
}
diff --git a/dubbo-demo/dubbo-demo-provider/pom.xml b/dubbo-demo/dubbo-demo-provider/pom.xml
index acdae783b89..53bc8278cf6 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.6-SNAPSHOT
dubbo-demo-provider
jar
@@ -53,7 +53,7 @@
com.alibaba
- dubbo-remoting-netty
+ dubbo-remoting-netty4
com.alibaba
diff --git a/dubbo-demo/pom.xml b/dubbo-demo/pom.xml
index d64b9cefa6b..436169b1930 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.6-SNAPSHOT
dubbo-demo
pom
diff --git a/dubbo-filter/dubbo-filter-cache/pom.xml b/dubbo-filter/dubbo-filter-cache/pom.xml
index aeb65003c95..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-SNAPSHOT
+ 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 31185c8413c..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-filter-validation
jar
diff --git a/dubbo-filter/pom.xml b/dubbo-filter/pom.xml
index 86ce451dab8..705e2841c31 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.6-SNAPSHOT
dubbo-filter
pom
diff --git a/dubbo-monitor/dubbo-monitor-api/pom.xml b/dubbo-monitor/dubbo-monitor-api/pom.xml
index 76531eb5602..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-SNAPSHOT
+ 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 9116062e130..f8175be69e2 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.6-SNAPSHOT
dubbo-monitor-default
jar
@@ -42,7 +42,7 @@
com.alibaba
- dubbo-remoting-netty
+ dubbo-remoting-netty4
${project.parent.version}
test
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();
}
diff --git a/dubbo-monitor/pom.xml b/dubbo-monitor/pom.xml
index 4970ad27ff0..794ea247a2f 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.6-SNAPSHOT
dubbo-monitor
pom
diff --git a/dubbo-plugin/dubbo-qos/pom.xml b/dubbo-plugin/dubbo-qos/pom.xml
index bb494121176..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
4.0.0
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();
+ }
+ }
}
diff --git a/dubbo-plugin/pom.xml b/dubbo-plugin/pom.xml
index a3ebbcb48cf..9623425fe8f 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.6-SNAPSHOT
4.0.0
diff --git a/dubbo-registry/dubbo-registry-api/pom.xml b/dubbo-registry/dubbo-registry-api/pom.xml
index 1bc1de39053..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-registry-api
jar
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/pom.xml b/dubbo-registry/dubbo-registry-default/pom.xml
index 0aa33f1f5aa..606d56a2165 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.6-SNAPSHOT
dubbo-registry-default
jar
@@ -49,7 +49,7 @@
com.alibaba
- dubbo-remoting-netty
+ dubbo-remoting-netty4
${project.parent.version}
test
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-registry/dubbo-registry-multicast/pom.xml b/dubbo-registry/dubbo-registry-multicast/pom.xml
index 15e2e31aa1f..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-SNAPSHOT
+ 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 e677972d85c..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-SNAPSHOT
+ 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 e812448d98c..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-registry-zookeeper
jar
diff --git a/dubbo-registry/pom.xml b/dubbo-registry/pom.xml
index c2ef9d5769d..b268a88d785 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.6-SNAPSHOT
dubbo-registry
pom
diff --git a/dubbo-remoting/dubbo-remoting-api/pom.xml b/dubbo-remoting/dubbo-remoting-api/pom.xml
index 1314e443e1e..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-remoting-api
jar
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;
}
diff --git a/dubbo-remoting/dubbo-remoting-grizzly/pom.xml b/dubbo-remoting/dubbo-remoting-grizzly/pom.xml
index 96bf6832817..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-SNAPSHOT
+ 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 b0aee41e26b..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-SNAPSHOT
+ 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 aea18f080bb..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-SNAPSHOT
+ 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 78e90565a96..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-remoting-netty
jar
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/pom.xml b/dubbo-remoting/dubbo-remoting-netty4/pom.xml
index 35c7d7eb6ed..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
4.0.0
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 b00bd97f489..56f5662f25e 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.6-SNAPSHOT
dubbo-remoting-p2p
jar
@@ -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-remoting/dubbo-remoting-zookeeper/pom.xml b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml
index cd518ac47b0..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-remoting-zookeeper
jar
diff --git a/dubbo-remoting/pom.xml b/dubbo-remoting/pom.xml
index 98affc30e4e..18c87cbe91f 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.6-SNAPSHOT
dubbo-remoting
pom
diff --git a/dubbo-rpc/dubbo-rpc-api/pom.xml b/dubbo-rpc/dubbo-rpc-api/pom.xml
index ede6069d473..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-rpc-api
jar
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:
+ *
+ *
+ * - return => return null
+ * - fail => default
+ * - force => default
+ * - fail:throw/return foo => throw/return foo
+ * - force:throw/return foo => throw/return foo
+ *
+ *
+ * @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;
}
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml
index 332e9811c37..4a628058079 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.6-SNAPSHOT
dubbo-rpc-dubbo
jar
@@ -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 dcedfcf6526..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
@@ -20,16 +20,16 @@
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;
+import org.junit.Ignore;
import org.junit.Test;
import java.lang.reflect.Field;
@@ -40,6 +40,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();
@@ -78,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");
@@ -89,14 +92,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());
@@ -162,4 +166,4 @@ public String get() {
return "ok";
}
}
-}
\ No newline at end of file
+}
diff --git a/dubbo-rpc/dubbo-rpc-hessian/pom.xml b/dubbo-rpc/dubbo-rpc-hessian/pom.xml
index ed66a81bef1..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-SNAPSHOT
+ 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 a7bf58b1e75..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-SNAPSHOT
+ 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 00a603e2c97..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-SNAPSHOT
+ 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 ed73b7c43d7..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-SNAPSHOT
+ 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 ce7e06346c1..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-SNAPSHOT
+ 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 5454db7aeca..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-SNAPSHOT
+ 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 e50d7b4ba5b..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-SNAPSHOT
+ 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 77d808aece2..f98ba99099b 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.6-SNAPSHOT
dubbo-rpc-thrift
jar
@@ -46,7 +46,7 @@
com.alibaba
- dubbo-remoting-netty
+ dubbo-remoting-netty4
${project.parent.version}
diff --git a/dubbo-rpc/dubbo-rpc-webservice/pom.xml b/dubbo-rpc/dubbo-rpc-webservice/pom.xml
index 30f6ae97612..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-rpc-webservice
jar
diff --git a/dubbo-rpc/pom.xml b/dubbo-rpc/pom.xml
index 2f5081654f7..daae30bad50 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.6-SNAPSHOT
dubbo-rpc
pom
diff --git a/dubbo-serialization/dubbo-serialization-api/pom.xml b/dubbo-serialization/dubbo-serialization-api/pom.xml
index 8adba7e3d86..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-SNAPSHOT
+ 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 fa047801c00..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-SNAPSHOT
+ 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 cbfe588e962..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-SNAPSHOT
+ 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 dc296f68bd0..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-SNAPSHOT
+ 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 eaa3f7562ff..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-SNAPSHOT
+ 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 49f11297b09..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-serialization-kryo
jar
diff --git a/dubbo-serialization/pom.xml b/dubbo-serialization/pom.xml
index b38ef1dfd5b..2be8ba66df8 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.6-SNAPSHOT
dubbo-serialization
pom
diff --git a/dubbo-test/dubbo-test-benchmark/pom.xml b/dubbo-test/dubbo-test-benchmark/pom.xml
index 04300b16a75..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-SNAPSHOT
+ 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 b001335bcc8..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-SNAPSHOT
+ 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 0234589ac76..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-SNAPSHOT
+ 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 3a1ce70fad4..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-SNAPSHOT
+ 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 b6d28637ab2..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-SNAPSHOT
+ 2.6.6-SNAPSHOT
dubbo-test-integration
jar
diff --git a/dubbo-test/pom.xml b/dubbo-test/pom.xml
index 68e67283446..ebfced6a400 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.6-SNAPSHOT
dubbo-test
pom
@@ -203,7 +203,7 @@
com.alibaba
dubbo-serialization-jdk
- 2.6.5-SNAPSHOT
+ 2.6.6-SNAPSHOT
org.hibernate
diff --git a/pom.xml b/pom.xml
index f12a635924b..7b430d9a3c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
com.alibaba
dubbo-parent
- 2.6.5-SNAPSHOT
+ 2.6.6-SNAPSHOT
pom
${project.artifactId}
@@ -138,7 +138,6 @@
dubbo-demo
dubbo-plugin
dubbo-serialization
- dubbo-bootstrap
dependencies-bom
bom
all
@@ -150,7 +149,7 @@
com.alibaba
dubbo-dependencies-bom
- 2.6.5-SNAPSHOT
+ 2.6.6-SNAPSHOT
pom
import
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