[incubator-dubbo-website] branch asf-site updated: Fix inconsistent port (#194)

2018-12-06 Thread huxing
This is an automated email from the ASF dual-hosted git repository.

huxing pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 7e44fbe  Fix inconsistent port (#194)
7e44fbe is described below

commit 7e44fbe19c660a79f2ed46865e027d443eff766e
Author: feiyunruyue 
AuthorDate: Fri Dec 7 15:39:23 2018 +0800

Fix inconsistent port (#194)
---
 docs/en-us/user/configuration/properties.md | 2 +-
 docs/zh-cn/user/configuration/properties.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/en-us/user/configuration/properties.md 
b/docs/en-us/user/configuration/properties.md
index 613ef7a..ece0414 100644
--- a/docs/en-us/user/configuration/properties.md
+++ b/docs/en-us/user/configuration/properties.md
@@ -15,7 +15,7 @@ Combine the tag name and attribute name of the XML tag, use 
`.` to split. One pr
 
 If you have more than one tags in a XML configuration, you can use the `id` 
value to distinguish. If you don't specify a id, ti will applied to all tags.
 
-* `dubbo.protocol.rmi.port=1234` equals to ` `
+* `dubbo.protocol.rmi.port=1099` equals to ` `
 * `dubbo.registry.china.address=10.20.153.10:9090` equals to ``
 
 Here is a typical dubbo.properties demo configuration:
diff --git a/docs/zh-cn/user/configuration/properties.md 
b/docs/zh-cn/user/configuration/properties.md
index f73c1cf..20d760a 100644
--- a/docs/zh-cn/user/configuration/properties.md
+++ b/docs/zh-cn/user/configuration/properties.md
@@ -16,7 +16,7 @@ Dubbo 将自动加载 classpath 根目录下的 dubbo.properties,可以通过J
 
 如果 XML 有多行同名标签配置,可用 id 号区分,如果没有 id 号将对所有同名标签生效
 
-* 比如:`dubbo.protocol.rmi.port=1234`等价于` ` [^2]
+* 比如:`dubbo.protocol.rmi.port=1099`等价于` ` [^2]
 * 比如:`dubbo.registry.china.address=10.20.153.10:9090`等价于``
 
 下面是 dubbo.properties 的一个典型配置:



[incubator-dubbo-website] branch asf-site updated: Fix mailing list (#195)

2018-12-06 Thread huxing
This is an automated email from the ASF dual-hosted git repository.

huxing pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new b394a0c  Fix mailing list (#195)
b394a0c is described below

commit b394a0cd4fdfdba91f62692092e56c6379277a96
Author: Li Han 
AuthorDate: Fri Dec 7 15:37:44 2018 +0800

Fix mailing list (#195)
---
 site_config/community.jsx | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/site_config/community.jsx b/site_config/community.jsx
index 2e14308..b4b52a2 100644
--- a/site_config/community.jsx
+++ b/site_config/community.jsx
@@ -44,7 +44,7 @@ export default {
   img: '/img/mailinglist.png',
   imgHover: '/img/mailinglist_hover.png',
   title: 'Mailing List',
-  link: 'mailto:d...@dubbo.apache.org'
+  link: 'mailto:dev-subscr...@dubbo.apache.org'
 },
 {
   img: '/img/alibaba.png',
@@ -73,7 +73,7 @@ export default {
 {
   img: '/img/mailinglist.png',
   title: 'Mailing List',
-  content: Join the mailto:d...@dubbo.apache.org;>mailing list and discussion your ideas 
with us.,
+  content: Join the mailto:dev-subscr...@dubbo.apache.org;>mailing list and discussion 
your ideas with us.,
 },
 {
   img: '/img/issue.png',
@@ -464,7 +464,7 @@ export default {
   img: '/img/mailinglist.png',
   imgHover: '/img/mailinglist_hover.png',
   title: '邮件列表',
-  link: 'mailto:d...@dubbo.apache.org'
+  link: 'mailto:dev-subscr...@dubbo.apache.org'
 },
 {
   img: '/img/alibaba.png',
@@ -493,7 +493,7 @@ export default {
 {
   img: '/img/mailinglist.png',
   title: '邮件列表',
-  content: 加入 mailto:d...@dubbo.apache.org;>邮件列表 
参与讨论。,
+  content: 加入 mailto:dev-subscr...@dubbo.apache.org;>邮件列表 参与讨论。,
 },
 {
   img: '/img/issue.png',



[incubator-dubbo-ops] branch service-test updated: service test execute

2018-12-06 Thread mjk
This is an automated email from the ASF dual-hosted git repository.

mjk pushed a commit to branch service-test
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git


The following commit(s) were added to refs/heads/service-test by this push:
 new 833caa8  service test execute
833caa8 is described below

commit 833caa8a776ea4af5f033aae06450c3f552e4ecb
Author: Jinkai Ma 
AuthorDate: Fri Dec 7 13:22:42 2018 +0800

service test execute
---
 dubbo-admin-backend/pom.xml|   4 +
 .../admin/controller/ServiceTestController.java|  16 ++-
 .../dubbo/admin/model/dto/ServiceTestDTO.java  |  40 +++
 .../admin/service/impl/GenericServiceImpl.java |  42 +++
 .../src/components/ServiceTest.vue | 127 -
 .../src/components/public/JsonEditor.vue   |   1 +
 pom.xml|  11 ++
 7 files changed, 210 insertions(+), 31 deletions(-)

diff --git a/dubbo-admin-backend/pom.xml b/dubbo-admin-backend/pom.xml
index 7986fbd..d2510ae 100644
--- a/dubbo-admin-backend/pom.xml
+++ b/dubbo-admin-backend/pom.xml
@@ -92,6 +92,10 @@
 
 
 
+org.apache.curator
+curator-recipes
+
+
 com.alibaba
 fastjson
 
diff --git 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/ServiceTestController.java
 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/ServiceTestController.java
index dfe14c4..3ded7c2 100644
--- 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/ServiceTestController.java
+++ 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/ServiceTestController.java
@@ -1,10 +1,20 @@
 package org.apache.dubbo.admin.controller;
 
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.apache.dubbo.admin.model.dto.ServiceTestDTO;
+import org.apache.dubbo.admin.service.impl.GenericServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
 @RestController
 @RequestMapping("/api/{env}/test")
 public class ServiceTestController {
-
+
+@Autowired
+private GenericServiceImpl genericService;
+
+@RequestMapping(method = RequestMethod.POST)
+public Object test(@PathVariable String env, @RequestBody ServiceTestDTO 
serviceTestDTO) {
+return genericService.invoke(serviceTestDTO.getService(), 
serviceTestDTO.getMethod(), serviceTestDTO.getTypes(), null);
+//return null;
+}
 }
diff --git 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/model/dto/ServiceTestDTO.java
 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/model/dto/ServiceTestDTO.java
new file mode 100644
index 000..7934e7c
--- /dev/null
+++ 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/model/dto/ServiceTestDTO.java
@@ -0,0 +1,40 @@
+package org.apache.dubbo.admin.model.dto;
+
+public class ServiceTestDTO {
+private String service;
+private String method;
+private String[] types;
+private String params;
+
+public String getService() {
+return service;
+}
+
+public void setService(String service) {
+this.service = service;
+}
+
+public String getMethod() {
+return method;
+}
+
+public void setMethod(String method) {
+this.method = method;
+}
+
+public String[] getTypes() {
+return types;
+}
+
+public void setTypes(String[] types) {
+this.types = types;
+}
+
+public String getParams() {
+return params;
+}
+
+public void setParams(String params) {
+this.params = params;
+}
+}
diff --git 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/GenericServiceImpl.java
 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/GenericServiceImpl.java
new file mode 100644
index 000..6b6e748
--- /dev/null
+++ 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/GenericServiceImpl.java
@@ -0,0 +1,42 @@
+package org.apache.dubbo.admin.service.impl;
+
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.registry.Registry;
+import org.apache.dubbo.rpc.service.GenericService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+@Component
+public class GenericServiceImpl {
+
+private ReferenceConfig reference;
+
+@Autowired
+private Registry registry;
+
+@PostConstruct
+public void init() {
+reference = new ReferenceConfig<>();
+reference.setGeneric(true);
+
+RegistryConfig registryConfig = new 

[incubator-dubbo] branch master updated: Graceful shutdown enhancement in Spring (#2901)

2018-12-06 Thread iluo
This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new ea71adb  Graceful shutdown enhancement in Spring (#2901)
ea71adb is described below

commit ea71adbf2a9526e3091b5c15d59e5e4b8872ca81
Author: LiZhen 
AuthorDate: Fri Dec 7 11:17:41 2018 +0800

Graceful shutdown enhancement in Spring (#2901)
---
 .../src/main/java/org/apache/dubbo/config/DubboShutdownHook.java| 4 ++--
 .../dubbo/config/spring/extension/SpringExtensionFactory.java   | 6 ++
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
index 90ed237..d554281 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
@@ -55,13 +55,13 @@ public class DubboShutdownHook extends Thread {
 if (logger.isInfoEnabled()) {
 logger.info("Run shutdown hook now.");
 }
-destroyAll();
+doDestroy();
 }
 
 /**
  * Destroy all the resources, including registries and protocols.
  */
-public void destroyAll() {
+public void doDestroy() {
 if (!destroyed.compareAndSet(false, true)) {
 return;
 }
diff --git 
a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/extension/SpringExtensionFactory.java
 
b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/extension/SpringExtensionFactory.java
index 99b538c..755db1a 100644
--- 
a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/extension/SpringExtensionFactory.java
+++ 
b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/extension/SpringExtensionFactory.java
@@ -44,6 +44,7 @@ public class SpringExtensionFactory implements 
ExtensionFactory {
 
 public static void addApplicationContext(ApplicationContext context) {
 contexts.add(context);
+
Runtime.getRuntime().removeShutdownHook(DubboShutdownHook.getDubboShutdownHook());
 BeanFactoryUtils.addApplicationListener(context, shutdownHookListener);
 }
 
@@ -105,11 +106,8 @@ public class SpringExtensionFactory implements 
ExtensionFactory {
 @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();
+shutdownHook.doDestroy();
 }
 }
 }



[incubator-dubbo-ops] branch service-test updated (3d80abf -> d6701a0)

2018-12-06 Thread min
This is an automated email from the ASF dual-hosted git repository.

min pushed a change to branch service-test
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git.


from 3d80abf  Service test page design
 add 31d136a  fix route update issue
 add 09f4793  back support 2.6
 new d6701a0  Merge branch 'metadata' into service-test

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../dubbo/admin/model/domain/OverrideConfig.java   |  8 
 .../admin/service/impl/OverrideServiceImpl.java|  8 
 .../dubbo/admin/service/impl/RouteServiceImpl.java |  2 +-
 .../src/components/governance/Overrides.vue| 22 +
 .../src/components/governance/RoutingRule.vue  | 23 ++
 5 files changed, 46 insertions(+), 17 deletions(-)



[incubator-dubbo-ops] 01/01: Merge branch 'metadata' into service-test

2018-12-06 Thread min
This is an automated email from the ASF dual-hosted git repository.

min pushed a commit to branch service-test
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git

commit d6701a04cc5a5ecaf2070f6035376c07f3c9c49d
Merge: 3d80abf 09f4793
Author: nzomkxia 
AuthorDate: Fri Dec 7 10:46:43 2018 +0800

Merge branch 'metadata' into service-test

 .../dubbo/admin/model/domain/OverrideConfig.java   |  8 
 .../admin/service/impl/OverrideServiceImpl.java|  8 
 .../dubbo/admin/service/impl/RouteServiceImpl.java |  2 +-
 .../src/components/governance/Overrides.vue| 22 +
 .../src/components/governance/RoutingRule.vue  | 23 ++
 5 files changed, 46 insertions(+), 17 deletions(-)



[incubator-dubbo-spring-boot-project] branch master updated: Intellij中的自动提示是dubbo.scan.base-packages导致我配置错误 (#233)

2018-12-06 Thread mercyblitz
This is an automated email from the ASF dual-hosted git repository.

mercyblitz pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-dubbo-spring-boot-project.git


The following commit(s) were added to refs/heads/master by this push:
 new 0fad8dc  Intellij中的自动提示是dubbo.scan.base-packages导致我配置错误 (#233)
0fad8dc is described below

commit 0fad8dc095a6402c74e6379d529e93a6a13d3b61
Author: 葛俊 
AuthorDate: Fri Dec 7 10:36:35 2018 +0800

Intellij中的自动提示是dubbo.scan.base-packages导致我配置错误 (#233)
---
 .../src/main/resources/META-INF/spring-configuration-metadata.json  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/dubbo-spring-boot-autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json
 
b/dubbo-spring-boot-autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json
index 8b6b282..078dae9 100644
--- 
a/dubbo-spring-boot-autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json
+++ 
b/dubbo-spring-boot-autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json
@@ -1090,7 +1090,7 @@
 },
 {
   "sourceType": "com.alibaba.boot.dubbo.autoconfigure.DubboScanProperties",
-  "name": "dubbo.scan.base-packages",
+  "name": "dubbo.scan.basePackages",
   "description": "The basePackages to scan , the multiple-value is 
delimited by comma\n\n @see EnableDubbo#scanBasePackages()",
   "type": "java.util.Set"
 }



[incubator-dubbo-ops] branch metadata updated: back support 2.6

2018-12-06 Thread min
This is an automated email from the ASF dual-hosted git repository.

min pushed a commit to branch metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git


The following commit(s) were added to refs/heads/metadata by this push:
 new 09f4793  back support 2.6
09f4793 is described below

commit 09f479395683dfb935a21d07fcb182186e7fda12
Author: nzomkxia 
AuthorDate: Fri Dec 7 10:06:12 2018 +0800

back support 2.6
---
 .../dubbo/admin/model/domain/OverrideConfig.java   |  8 
 .../admin/service/impl/OverrideServiceImpl.java|  8 
 .../dubbo/admin/service/impl/RouteServiceImpl.java |  2 +-
 .../src/components/governance/Overrides.vue| 22 ++
 .../src/components/governance/RoutingRule.vue  | 21 ++---
 5 files changed, 45 insertions(+), 16 deletions(-)

diff --git 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/model/domain/OverrideConfig.java
 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/model/domain/OverrideConfig.java
index 893c19b..4fa10e4 100644
--- 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/model/domain/OverrideConfig.java
+++ 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/model/domain/OverrideConfig.java
@@ -17,13 +17,13 @@
 
 package org.apache.dubbo.admin.model.domain;
 
-import org.apache.dubbo.admin.common.util.Pair;
+import java.util.Map;
 
 public class OverrideConfig {
 private String side;
 private String[] addresses;
 private String[] providerAddresses;
-private Pair[] parameters;
+private Map parameters;
 private String[] applications;
 private String[] services;
 
@@ -51,11 +51,11 @@ public class OverrideConfig {
 this.providerAddresses = providerAddresses;
 }
 
-public Pair[] getParameters() {
+public Map getParameters() {
 return parameters;
 }
 
-public void setParameters(Pair[] parameters) {
+public void setParameters(Map parameters) {
 this.parameters = parameters;
 }
 
diff --git 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/OverrideServiceImpl.java
 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/OverrideServiceImpl.java
index 0d4d4c5..fb3b420 100644
--- 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/OverrideServiceImpl.java
+++ 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/OverrideServiceImpl.java
@@ -18,7 +18,6 @@ package org.apache.dubbo.admin.service.impl;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.dubbo.admin.common.util.Constants;
-import org.apache.dubbo.admin.common.util.Pair;
 import org.apache.dubbo.admin.common.util.YamlParser;
 import org.apache.dubbo.admin.model.domain.Override;
 import org.apache.dubbo.admin.model.domain.OverrideConfig;
@@ -28,6 +27,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -177,12 +177,12 @@ public class OverrideServiceImpl extends AbstractService 
implements OverrideServ
 }
 
 private void overrideDTOToParams(Override override, OverrideConfig config) 
{
-Pair[] parameters = config.getParameters();
+Map parameters = config.getParameters();
 StringBuilder params = new StringBuilder();
 
 if (parameters != null) {
-for (Pair param : parameters) {
-String value = param.getKey() + "=" + param.getValue();
+for (Map.Entry entry : parameters.entrySet()) {
+String value = entry.getKey() + "=" + entry.getValue();
 params.append(value).append("&");
 }
 }
diff --git 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/RouteServiceImpl.java
 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/RouteServiceImpl.java
index d3e89cb..5e6eb56 100644
--- 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/RouteServiceImpl.java
+++ 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/service/impl/RouteServiceImpl.java
@@ -38,8 +38,8 @@ public class RouteServiceImpl extends AbstractService 
implements RouteService {
 
 @Override
 public void createConditionRoute(ConditionRouteDTO conditionRoute) {
-String path = 
getPath(conditionRoute.getKey(),Constants.CONDITION_ROUTE);
 conditionRoute = convertRouteDTOtoStore(conditionRoute);
+String path = 
getPath(conditionRoute.getKey(),Constants.CONDITION_ROUTE);
 //register2.7
 dynamicConfiguration.setConfig(path, 
YamlParser.dumpObject(conditionRoute));
 
diff --git a/dubbo-admin-frontend/src/components/governance/Overrides.vue 
b/dubbo-admin-frontend/src/components/governance/Overrides.vue
index dfa92d0..64c7291 100644
--- a/dubbo-admin-frontend/src/components/governance/Overrides.vue
+++ 

[incubator-dubbo] branch master updated: fix testCustomExecutor (#2904)

2018-12-06 Thread iluo
This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new 743da20  fix testCustomExecutor (#2904)
743da20 is described below

commit 743da200f607124e5c0b40d55bfe57f2fbc3084f
Author: gude 
AuthorDate: Fri Dec 7 10:00:43 2018 +0800

fix testCustomExecutor (#2904)
---
 .../apache/dubbo/common/concurrent/CompletableFutureTaskTest.java| 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/dubbo-common/src/test/java/org/apache/dubbo/common/concurrent/CompletableFutureTaskTest.java
 
b/dubbo-common/src/test/java/org/apache/dubbo/common/concurrent/CompletableFutureTaskTest.java
index 42563d4..2c98f9f 100644
--- 
a/dubbo-common/src/test/java/org/apache/dubbo/common/concurrent/CompletableFutureTaskTest.java
+++ 
b/dubbo-common/src/test/java/org/apache/dubbo/common/concurrent/CompletableFutureTaskTest.java
@@ -20,6 +20,8 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
 
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
@@ -94,6 +96,7 @@ public class CompletableFutureTaskTest {
 CompletableFuture completableFuture = 
CompletableFuture.supplyAsync(() -> {
 return 0;
 });
-completableFuture.thenRunAsync(mock(Runnable.class), 
verify(mockedExecutor));
+completableFuture.thenRunAsync(mock(Runnable.class), mockedExecutor);
+verify(mockedExecutor, times(1)).execute(any());
 }
 }
\ No newline at end of file



[incubator-dubbo] branch master updated: Close all ports after tests finish (#2906)

2018-12-06 Thread iluo
This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new 8a8650f  Close all ports after tests finish (#2906)
8a8650f is described below

commit 8a8650f4834501b2a891c4bda85c6a4e42b08cc8
Author: OrDTesters <44483852+ordtest...@users.noreply.github.com>
AuthorDate: Thu Dec 6 19:58:07 2018 -0600

Close all ports after tests finish (#2906)
---
 .../apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java  | 6 ++
 .../org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java  | 6 ++
 .../org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java  | 1 +
 .../java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java  | 7 +++
 .../java/org/apache/dubbo/rpc/protocol/dubbo/RpcFilterTest.java| 7 +++
 5 files changed, 27 insertions(+)

diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java
index ced3d06..14ab124 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvilableTest.java
@@ -26,6 +26,7 @@ import org.apache.dubbo.remoting.exchange.ExchangeClient;
 import org.apache.dubbo.rpc.Exporter;
 import org.apache.dubbo.rpc.ProxyFactory;
 import org.apache.dubbo.rpc.protocol.dubbo.support.ProtocolUtils;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -51,6 +52,11 @@ public class DubboInvokerAvilableTest {
 public void setUp() throws Exception {
 }
 
+@AfterClass
+public static void tearDownAfterClass() {
+ProtocolUtils.closeAll();
+}
+
 @Test
 public void test_Normal_available() {
 URL url = 
URL.valueOf("dubbo://127.0.0.1:20883/org.apache.dubbo.rpc.protocol.dubbo.IDemoService");
diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java
index 4efad6f..31a4421 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java
@@ -22,6 +22,7 @@ import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.utils.NetUtils;
 import org.apache.dubbo.rpc.RpcException;
 import org.apache.dubbo.rpc.protocol.dubbo.support.ProtocolUtils;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -40,6 +41,11 @@ public class DubboLazyConnectTest {
 public void setUp() throws Exception {
 }
 
+@AfterClass
+public static void tearDownAfterClass() {
+ProtocolUtils.closeAll();
+}
+
 @Test(expected = RpcException.class)
 public void testSticky1() {
 URL url = 
URL.valueOf("dubbo://127.0.0.1:9090/org.apache.dubbo.rpc.protocol.dubbo.IDemoService");
diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java
index 3c8aecd..e7a2b2a 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java
@@ -49,6 +49,7 @@ public class ExplicitCallbackTest {
 @After
 public void tearDown() {
 destroyService();
+ProtocolUtils.closeAll();
 }
 
 public void exportService() {
diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java
index ce43473..04c3645 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java
@@ -23,6 +23,8 @@ import org.apache.dubbo.rpc.Protocol;
 import org.apache.dubbo.rpc.ProxyFactory;
 import org.apache.dubbo.rpc.protocol.dubbo.support.DemoService;
 import org.apache.dubbo.rpc.protocol.dubbo.support.DemoServiceImpl;
+import org.apache.dubbo.rpc.protocol.dubbo.support.ProtocolUtils;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -36,6 +38,11 @@ public class MultiThreadTest {
 private Protocol protocol = 

[incubator-dubbo] branch dev-metadata updated: [DOCS]:[fix comment statement and reformat code] (#2844)

2018-12-06 Thread iluo
This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/dev-metadata by this push:
 new 48e482e  [DOCS]:[fix comment statement and reformat code] (#2844)
48e482e is described below

commit 48e482e0e71c93be9d8c576c842123bb30363fc8
Author: Yangki Zhang 
AuthorDate: Fri Dec 7 09:56:56 2018 +0800

[DOCS]:[fix comment statement and reformat code] (#2844)
---
 .../dubbo/configcenter/AbstractDynamicConfiguration.java | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
 
b/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
index 6d711ba..9cd120f 100644
--- 
a/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
+++ 
b/dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/AbstractDynamicConfiguration.java
@@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentMap;
  * Dynamic configuration template class. The concrete implementation needs to 
provide implementation for three methods.
  *
  * @see AbstractDynamicConfiguration#getTargetConfig(String, String, long)
- * @see AbstractDynamicConfiguration#addConfigurationListener(String key, 
TargetListener, ConfigurationListener)
+ * @see AbstractDynamicConfiguration#addConfigurationListener(String, 
TargetListener, ConfigurationListener)
  * @see AbstractDynamicConfiguration#createTargetListener(String)
  */
 public abstract class AbstractDynamicConfiguration extends 
AbstractConfiguration
@@ -36,8 +36,7 @@ public abstract class 
AbstractDynamicConfiguration extends Abstr
 protected URL url;
 
 // One key can register multiple target listeners, but one target listener 
only maps to one configuration listener
-protected ConcurrentMap targetListeners =
-new ConcurrentHashMap<>();
+protected ConcurrentMap targetListeners = new 
ConcurrentHashMap<>();
 
 public AbstractDynamicConfiguration() {
 }
@@ -96,8 +95,9 @@ public abstract class 
AbstractDynamicConfiguration extends Abstr
 /**
  * Register a native listener to the backend config storage so that Dubbo 
has chance to get notified when the
  * value changes.
- * @param key
- * @param targetListener Implementation dependent listener, such as, 
zookeeper watcher, Apollo listener, ...
+ *
+ * @param key   property key
+ * @param targetListenerImplementation dependent listener, such 
as, zookeeper watcher, Apollo listener, ...
  * @param configurationListener Listener in Dubbo that will handle 
notification.
  */
 protected abstract void addConfigurationListener(String key, 
TargetListener targetListener, ConfigurationListener configurationListener);
@@ -106,7 +106,7 @@ public abstract class 
AbstractDynamicConfiguration extends Abstr
  * Create a native listener for the backend config storage, eventually 
ConfigurationListener will get notified once
  * the value changes.
  *
- * @param key  property key the native listener will listen on
+ * @param key property key the native listener will listen on
  * @return native listener for the backend config storage
  */
 protected abstract TargetListener createTargetListener(String key);



[incubator-dubbo] branch master updated: Optimize getExtensionClass method. (#2788)

2018-12-06 Thread huxing
This is an automated email from the ASF dual-hosted git repository.

huxing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new 628ad77  Optimize getExtensionClass method. (#2788)
628ad77 is described below

commit 628ad777b963fb450873a5fd38eebf99002bbc68
Author: 时无两丶 <442367...@qq.com>
AuthorDate: Thu Dec 6 22:47:27 2018 +0800

Optimize getExtensionClass method. (#2788)

Just return the class instead of throwing exception.
---
 .../org/apache/dubbo/common/extension/ExtensionLoader.java | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
index 31f72e6..49a7bdb 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
@@ -346,12 +346,8 @@ public class ExtensionLoader {
 if (name == null || name.length() == 0) {
 throw new IllegalArgumentException("Extension name == null");
 }
-try {
-this.getExtensionClass(name);
-return true;
-} catch (Throwable t) {
-return false;
-}
+Class c = this.getExtensionClass(name);
+return c != null;
 }
 
 public Set getSupportedExtensions() {
@@ -565,11 +561,7 @@ public class ExtensionLoader {
 if (name == null) {
 throw new IllegalArgumentException("Extension name == null");
 }
-Class clazz = getExtensionClasses().get(name);
-if (clazz == null) {
-throw new IllegalStateException("No such extension \"" + name + 
"\" for " + type.getName() + "!");
-}
-return clazz;
+return getExtensionClasses().get(name);
 }
 
 private Map> getExtensionClasses() {



[incubator-dubbo] branch master updated: feat:Improve the annotation of LeastActiveLoadBalance (#2893)

2018-12-06 Thread iluo
This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new 63bf28d  feat:Improve the annotation of LeastActiveLoadBalance (#2893)
63bf28d is described below

commit 63bf28da8c173f474a5643ca716876db2d3aae9a
Author: zhuzi <42179163+hao-zh...@users.noreply.github.com>
AuthorDate: Thu Dec 6 19:32:11 2018 +0800

feat:Improve the annotation of LeastActiveLoadBalance (#2893)
---
 .../loadbalance/LeastActiveLoadBalance.java| 69 +++---
 1 file changed, 48 insertions(+), 21 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java
index 1516317..860dd3d 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java
@@ -26,6 +26,11 @@ import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * LeastActiveLoadBalance
+ * 
+ * Filter the number of invokers with the least number of active calls and 
count the weights and quantities of these invokers.
+ * If there is only one invoker, use the invoker directly;
+ * if there are multiple invokers and the weights are not the same, then 
random according to the total weight;
+ * if there are multiple invokers and the same weight, then randomly called.
  */
 public class LeastActiveLoadBalance extends AbstractLoadBalance {
 
@@ -33,27 +38,48 @@ public class LeastActiveLoadBalance extends 
AbstractLoadBalance {
 
 @Override
 protected  Invoker doSelect(List> invokers, URL url, 
Invocation invocation) {
-int length = invokers.size(); // Number of invokers
-int leastActive = -1; // The least active value of all invokers
-int leastCount = 0; // The number of invokers having the same least 
active value (leastActive)
-int[] leastIndexes = new int[length]; // The index of invokers having 
the same least active value (leastActive)
-int totalWeight = 0; // The sum of with warmup weights
-int firstWeight = 0; // Initial value, used for comparision
-boolean sameWeight = true; // Every invoker has the same weight value?
+// Number of invokers
+int length = invokers.size();
+// The least active value of all invokers
+int leastActive = -1;
+// The number of invokers having the same least active value 
(leastActive)
+int leastCount = 0;
+// The index of invokers having the same least active value 
(leastActive)
+int[] leastIndexes = new int[length];
+// The sum of the warmup weights of all the least active invokes
+int totalWeight = 0;
+// The weight of the first least active invoke
+int firstWeight = 0;
+// Every least active invoker has the same weight value?
+boolean sameWeight = true;
+
+// Filter out all the least active invokers
 for (int i = 0; i < length; i++) {
 Invoker invoker = invokers.get(i);
-int active = RpcStatus.getStatus(invoker.getUrl(), 
invocation.getMethodName()).getActive(); // Active number
+// Get the active number of the invoke
+int active = RpcStatus.getStatus(invoker.getUrl(), 
invocation.getMethodName()).getActive();
+// Get the weight of the invoke configuration. The default value 
is 100.
 int afterWarmup = getWeight(invoker, invocation);
-if (leastActive == -1 || active < leastActive) { // Restart, when 
find a invoker having smaller least active value.
-leastActive = active; // Record the current least active value
-leastCount = 1; // Reset leastCount, count again based on 
current leastCount
-leastIndexes[0] = i; // Reset
-totalWeight = afterWarmup; // Reset
-firstWeight = afterWarmup; // Record the weight the first 
invoker
-sameWeight = true; // Reset, every invoker has the same weight 
value?
-} else if (active == leastActive) { // If current invoker's active 
value equals with leaseActive, then accumulating.
-leastIndexes[leastCount++] = i; // Record index number of this 
invoker
-totalWeight += afterWarmup; // Add this invoker's with warmup 
weight to totalWeight.
+// If it is the first invoker or the active number of the invoker 
is less than the current least active number
+if (leastActive == -1 || active < leastActive) {
+// Reset the active number of the current invoker to the least 
active number
+leastActive = active;
+// Reset the 

[incubator-dubbo] branch master updated: Merge pull request #2887, fix consumer stub bug in multi registries.

2018-12-06 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 585b3a5  Merge pull request #2887, fix consumer stub bug in multi 
registries.
585b3a5 is described below

commit 585b3a5c4cee72dc0a597cef22bce83cd2df2d52
Author: Ian Luo 
AuthorDate: Thu Dec 6 17:48:19 2018 +0800

Merge pull request #2887, fix consumer stub bug in multi registries.

fixes #2850
---
 .../apache/dubbo/rpc/cluster/directory/AbstractDirectory.java | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
index 0cea0b8..f650b6e 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
@@ -21,6 +21,7 @@ import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.extension.ExtensionLoader;
 import org.apache.dubbo.common.logger.Logger;
 import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.StringUtils;
 import org.apache.dubbo.rpc.Invocation;
 import org.apache.dubbo.rpc.Invoker;
 import org.apache.dubbo.rpc.RpcException;
@@ -32,6 +33,7 @@ import 
org.apache.dubbo.rpc.cluster.router.MockInvokersSelector;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Abstract implementation of Directory: Invoker list returned from this 
Directory's list method have been filtered by Routers
@@ -62,7 +64,14 @@ public abstract class AbstractDirectory implements 
Directory {
 if (url == null) {
 throw new IllegalArgumentException("url == null");
 }
-this.url = url;
+
+if (url.getProtocol().equals(Constants.REGISTRY_PROTOCOL)) {
+Map queryMap = 
StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY));
+this.url = 
url.clearParameters().addParameters(queryMap).removeParameter(Constants.MONITOR_KEY);
+} else {
+this.url = url;
+}
+
 this.consumerUrl = consumerUrl;
 setRouters(routers);
 }