[dubbo] branch master updated: set EXTENSION_LOADERS/EXTENSION_INSTANCE default size to 64 (#5812)
This is an automated email from the ASF dual-hosted git repository. tswstarplanet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo.git The following commit(s) were added to refs/heads/master by this push: new f3fb252 set EXTENSION_LOADERS/EXTENSION_INSTANCE default size to 64 (#5812) f3fb252 is described below commit f3fb25282378271bb2b2b81d3a9e0e1e9446bbb7 Author: xylsh AuthorDate: Sat Mar 7 16:08:12 2020 +0800 set EXTENSION_LOADERS/EXTENSION_INSTANCE default size to 64 (#5812) --- .../main/java/org/apache/dubbo/common/extension/ExtensionLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 842a43f..b53729e 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 @@ -87,9 +87,9 @@ public class ExtensionLoader { private static final Pattern NAME_SEPARATOR = Pattern.compile("\\s*[,]+\\s*"); -private static final ConcurrentMap, ExtensionLoader> EXTENSION_LOADERS = new ConcurrentHashMap<>(); +private static final ConcurrentMap, ExtensionLoader> EXTENSION_LOADERS = new ConcurrentHashMap<>(64); -private static final ConcurrentMap, Object> EXTENSION_INSTANCES = new ConcurrentHashMap<>(); +private static final ConcurrentMap, Object> EXTENSION_INSTANCES = new ConcurrentHashMap<>(64); private final Class type;
[dubbo-website] branch asf-site updated: Automated deployment: Sat Mar 7 08:18:56 UTC 2020 f2181bb96fe95d72e1a412dff0ac6bd908afdf23
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/dubbo-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 6424dad Automated deployment: Sat Mar 7 08:18:56 UTC 2020 f2181bb96fe95d72e1a412dff0ac6bd908afdf23 6424dad is described below commit 6424dad744d2f462446e6d669114c1c9c83dfd50 Author: lixiaojiee AuthorDate: Sat Mar 7 08:18:56 2020 + Automated deployment: Sat Mar 7 08:18:56 UTC 2020 f2181bb96fe95d72e1a412dff0ac6bd908afdf23 --- zh-cn/docs/user/demos/graceful-shutdown.html | 2 +- zh-cn/docs/user/demos/graceful-shutdown.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/docs/user/demos/graceful-shutdown.html b/zh-cn/docs/user/demos/graceful-shutdown.html index 303fc28..a30ccda 100644 --- a/zh-cn/docs/user/demos/graceful-shutdown.html +++ b/zh-cn/docs/user/demos/graceful-shutdown.html @@ -30,7 +30,7 @@ # dubbo.properties dubbo.service.shutdown.wait=15000 -如果 ShutdownHook 不能生效,可以自行调用,使用tomcat等容器部署的場景,建议通过扩展ContextListener等自行调用以下代码实现优雅停机: +如果 ShutdownHook 不能生效,可以自行调用,使用tomcat等容器部署的场景,建议通过扩展ContextListener等自行调用以下代码实现优雅停机: DubboShutdownHook.destroyAll(); ASFhttp://www.apache.org; target="_self">基金会http://www.apache.org/licenses/; target="_self">证书http://www.apache.org/events/current-event; target="_self">事件优雅停机\nDubbo 是通过 JDK 的 ShutdownHook 来完成优雅停机的,所以如果用户使用 kill -9 PID 等强制关闭指令,是不会执行优雅停机的,只有通过 kill PID 时,才会执行。\n原理\n服务提供方\n\n停止时,先标记为不接收新请求,新请求过来时直接报错,让客户端重试其它机器。\n然后,检测线程池中的线程是否正在运行,如果有,等待所有线程执行完成,除非超时,则强制关闭。\n\n服务消费方\n\n停止时,不再发起新的调用请求,所有新的调用在客户端即报错。\n然后,检测有没有请求的响应还没有返回,等待响应返回,除非超时,则强制关闭。\n\n设置方式\n设置优雅停机超时时间,缺省超时时间是 10 秒,如果超时则强制关闭。\n优雅停机\nDubbo 是通过 JDK 的 ShutdownHook 来完成优雅停机的,所以如果用户使用 kill -9 PID 等强制关闭指令,是不会执行优雅停机的,只有通过 kill PID 时,才会执行。\n原理\n服务提供方\n\n停止时,先标记为不接收新请求,新请求过来时直接报错,让客户端重试其它机器。\n然后,检测线程池中的线程是否正在运行,如果有,等待所有线程执行完成,除非超时,则强制关闭。\n\n服务消费方\n\n停止时,不再发起新的调用请求,所有新的调用在客户端即报错。\n然后,检测有没有请求的响应还没有返回,等待响应返回,除非超时,则强制关闭。\n\n设置方式\n设置优雅停机超时时间,缺省超时时间是 10 秒,如果超时则强制关闭。\n
[dubbo-website] branch master updated: Update graceful-shutdown.md (#566)
This is an automated email from the ASF dual-hosted git repository. lixiaojie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-website.git The following commit(s) were added to refs/heads/master by this push: new f2181bb Update graceful-shutdown.md (#566) f2181bb is described below commit f2181bb96fe95d72e1a412dff0ac6bd908afdf23 Author: liber-xk <61538821+liber...@users.noreply.github.com> AuthorDate: Sat Mar 7 16:17:21 2020 +0800 Update graceful-shutdown.md (#566) --- docs/zh-cn/user/demos/graceful-shutdown.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh-cn/user/demos/graceful-shutdown.md b/docs/zh-cn/user/demos/graceful-shutdown.md index 8c6da4f..43dcd9b 100644 --- a/docs/zh-cn/user/demos/graceful-shutdown.md +++ b/docs/zh-cn/user/demos/graceful-shutdown.md @@ -23,8 +23,8 @@ Dubbo 是通过 JDK 的 ShutdownHook 来完成优雅停机的,所以如果用 dubbo.service.shutdown.wait=15000 ``` -如果 ShutdownHook 不能生效,可以自行调用,**使用tomcat等容器部署的場景,建议通过扩展ContextListener等自行调用以下代码实现优雅停机**: +如果 ShutdownHook 不能生效,可以自行调用,**使用tomcat等容器部署的场景,建议通过扩展ContextListener等自行调用以下代码实现优雅停机**: ```java DubboShutdownHook.destroyAll(); -``` \ No newline at end of file +```
[dubbo-go-hessian2] branch master updated: Update codecov
This is an automated email from the ASF dual-hosted git repository. alexstocks pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git The following commit(s) were added to refs/heads/master by this push: new 5d2e8a8 Update codecov new 3b52d42 Merge pull request #162 from fangyincheng/master 5d2e8a8 is described below commit 5d2e8a8ff8cb8827a1a026c7c84f1276513fc9fa Author: fangyincheng AuthorDate: Sat Mar 7 18:01:41 2020 +0800 Update codecov --- .travis.yml | 5 - README.md | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a780a1..0181446 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,10 @@ script: - mvn clean package -f test_hessian/pom.xml - mvn clean package -f test_dubbo/pom.xml - go fmt && [[ -z `git status -s` ]] - - GO111MODULE=on && go mod vendor && go test -race -v && go test -bench . -race + - GO111MODULE=on && go mod vendor && go test -race -v && go test -bench . -race -coverprofile=coverage.txt + +after_success: + - bash <(curl -s https://codecov.io/bash) notifications: webhooks: https://oapi.dingtalk.com/robot/send?access_token=27a5eb4510c8cf913b67a72832549b123a8c44655483d20443515604669de0ae \ No newline at end of file diff --git a/README.md b/README.md index 3863226..349777b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # gohessian [![Build Status](https://travis-ci.org/apache/dubbo-go-hessian2.png?branch=master)](https://travis-ci.org/apache/dubbo-go-hessian2) -[![GoCover](http://gocover.io/_badge/github.com/apache/dubbo-go-hessian2)](http://gocover.io/github.com/apache/dubbo-go-hessian2) +[![codecov](https://codecov.io/gh/apache/dubbo-go-hessian2/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/dubbo-go-hessian2) [![GoDoc](https://godoc.org/github.com/apache/dubbo-go-hessian2?status.svg)](https://godoc.org/github.com/apache/dubbo-go-hessian2)
[dubbo-website] branch master updated: Fix word spelling (#563)
This is an automated email from the ASF dual-hosted git repository. lixiaojie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-website.git The following commit(s) were added to refs/heads/master by this push: new e413ef9 Fix word spelling (#563) e413ef9 is described below commit e413ef992c8974d5302b0065a1958ff66eeecdba Author: withthewind AuthorDate: Sat Mar 7 16:19:14 2020 +0800 Fix word spelling (#563) --- docs/en-us/user/dependencies.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en-us/user/dependencies.md b/docs/en-us/user/dependencies.md index 2d9b494..437dce5 100644 --- a/docs/en-us/user/dependencies.md +++ b/docs/en-us/user/dependencies.md @@ -50,7 +50,7 @@ These dependencies needs to be added to project manually,when you need them. * slf4j: 1.7.25 * log4j: 1.2.16 -[^1]: In theory, Dubbo only depend on JDK, not depend on any 3rd party libs, you can finish logic by useing JDK. +[^1]: In theory, Dubbo only depend on JDK, not depend on any 3rd party libs, you can finish logic by using JDK. [^2]: Log output jar [^3]: Bytecode generation [^4]: Configuration parsing
[dubbo-go-hessian2] branch master updated: Add: github dingding url
This is an automated email from the ASF dual-hosted git repository. alexstocks pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git The following commit(s) were added to refs/heads/master by this push: new 27422e2 Add: github dingding url 27422e2 is described below commit 27422e2365c3cd7e0ae160ba0da4d05cf49d0644 Author: alexstocks AuthorDate: Sat Mar 7 21:32:59 2020 +0800 Add: github dingding url --- .travis.yml | 3 ++- go.mod | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0181446..a711aab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,4 +18,5 @@ after_success: - bash <(curl -s https://codecov.io/bash) notifications: - webhooks: https://oapi.dingtalk.com/robot/send?access_token=27a5eb4510c8cf913b67a72832549b123a8c44655483d20443515604669de0ae \ No newline at end of file + webhooks: https://oapi.dingtalk.com/robot/send?access_token=27a5eb4510c8cf913b67a72832549b123a8c44655483d20443515604669de0ae + webhooks: https://oapi.dingtalk.com/robot/send?access_token=8250008579ed1defda3a44fb8608a38d81a55700fdfb15466315a90a7dd2045f diff --git a/go.mod b/go.mod index 8497c83..4a2c293 100644 --- a/go.mod +++ b/go.mod @@ -5,3 +5,5 @@ require ( github.com/pkg/errors v0.8.1 github.com/stretchr/testify v1.4.0 ) + +go 1.13
[dubbo-website] branch master updated: post a blog about dubbo consistent hash implementation (#553)
This is an automated email from the ASF dual-hosted git repository. wangxin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-website.git The following commit(s) were added to refs/heads/master by this push: new 1c41196 post a blog about dubbo consistent hash implementation (#553) 1c41196 is described below commit 1c41196ff38c31a49f925910510849921386112a Author: Kyle AuthorDate: Sun Mar 8 00:21:49 2020 +0800 post a blog about dubbo consistent hash implementation (#553) --- blog/zh-cn/dubbo-consistent-hash-implementation.md | 128 + .../consistent-hash-balance-model.jpg | Bin 0 -> 29205 bytes .../consistent-hash-delete-node-model.jpg | Bin 0 -> 32314 bytes .../consistenthash/consistent-hash-init-model.jpg | Bin 0 -> 29515 bytes .../consistent-hash-new-node-model.jpg | Bin 0 -> 35015 bytes .../consistent-hash-request-model.jpg | Bin 0 -> 34165 bytes .../consistent-hash-virtual-node-model.jpg | Bin 0 -> 33019 bytes site_config/blog.js| 9 +- 8 files changed, 136 insertions(+), 1 deletion(-) diff --git a/blog/zh-cn/dubbo-consistent-hash-implementation.md b/blog/zh-cn/dubbo-consistent-hash-implementation.md new file mode 100644 index 000..29ffb67 --- /dev/null +++ b/blog/zh-cn/dubbo-consistent-hash-implementation.md @@ -0,0 +1,128 @@ +--- +title: Dubbo一致性Hash负载均衡实现剖析 +keywords: Dubbo, Consistent Hash,一致性Hash,一致性哈希 +description: 本文以一般的一致性Hash实现作为引子,详细剖析了Dubbo一致性Hash负载均衡算法的实现 +--- + +需要强调的是,Dubbo的Hash映射模型与大部分网上资料描述的**环形队列Hash映射模型**是存在一些区别的。于我而言,环形队列Hash映射模型,不足以让我对一致性Hash有足够彻底的了解。直到看懂了Dubbo的一致性Hash的实现,才觉得豁然开朗。 + + + +### 一、环形队列Hash映射模型 + +这种方案,其基础还是基于取模运算。对2^32取模,那么,Hash值的区间为[0, 2^32-1]。接下来要做的,就包括两部分: + + **a、映射服务** + +将服务地址(ip+端口)按照一定规则构造出特定的识别码(如md5码),再用识别码对2^32取模,确定服务在Hash值区间对应的位置。假设有Node1、Node2、Node3三个服务,其映射关系如下: + +![Init](../../img/blog/consistenthash/consistent-hash-init-model.jpg) + + + + **b、映射请求、定位服务** + +在发起请求时,我们往往会带上参数,而这些参数,就可以被我们用来确定具体调用哪一个服务。假设有请求R1、R2、R3,对它们的参数也经过计算特定识别码、取余的一系列运算之后,有如下映射关系: + +![Request](../../img/blog/consistenthash/consistent-hash-request-model.jpg) + +从图中,我们可以看到,R1请求映射在0-Node1中间,R2请求映射在Node1-Node2中间,R3请求映射在Node2-Node3中间。我们取**服务Hash值大于请求Hash值**的**第一个服务**作为实际的调用服务。也就是说,R1请求将调用Node1服务,R2请求将调用Node2服务,R3请求将调用Node3服务。 + + + + **c、新增服务节点** + +假设新增服务Node4,映射在Node3之前,恰巧破坏了原来的一个映射关系: + +![New Node](../../img/blog/consistenthash/consistent-hash-new-node-model.jpg) + +这样,请求R3将会实际调用服务Node4,但请求R1、R2不受影响。 + + + + **d、删除服务节点** + +假设服务Node2宕机,那么R2请求将会映射到Node3: + +![Delete Node](../../img/blog/consistenthash/consistent-hash-delete-node-model.jpg) + +原本的R1、R3请求不受影响。 + + + +> 可以看出,当新增、删除服务时,受影响的请求是有限的。不至于像简单取模映射一般,服务发生变化时,需要调整全局的映射关系。 + + + + **e、平衡性与虚拟节点** + +在我们上面的假设中,我们假设Node1、Node2、Node3三个服务在经过Hash映射后所分布的位置恰巧把环切成了均等的三分,请求的分布也基本是平衡的。但是实际上计算服务Hash值的时候,是很难这么巧的。也许一不小心就映射成了这个样子: + +![Balance](../../img/blog/consistenthash/consistent-hash-balance-model.jpg) + +这样,就会导致大部分请求都会被映射到Node1上。因此,引出了虚拟节点。 + +所谓虚拟节点,就是除了对服务本身地址进行Hash映射外,还通过在它地址上做些处理(比如Dubbo中,在ip+port的字符串后加上计数符1、2、3..,分别代表虚拟节点1、2、3),以达到同一服务映射多个节点的目的。通过引入虚拟节点,我们可以把上图中映射给Node1的请求进一步拆分: + +![Virtual Node](../../img/blog/consistenthash/consistent-hash-virtual-node-model.jpg) + +如上图所示,若有请求落在Node3-Node1'区间,该请求应该是调用Node1'服务,但是因为Node1'是Node1的虚拟节点,所以实际调用的是Node1服务。通过引入虚拟节点,请求的分布就会比较平衡了。 + + + +### **二、Dubbo一致性Hash的使用与负载均衡策略的引入阶段** + + **a、如何使用一致性Hash作为Dubbo的负载均衡策略?** + +dubbo:service、dubbo:reference、dubbo:provider、dubbo:consumer、dubbo:method这几个配置项都可以配置Dubbo的负载均衡策略,其中一致性Hash的属性值是:**consistenthash**。 + +以dubbo:reference为例: + +**XML配置:** + +> + + + +**Properties配置:** + +> dubbo.reference.loadbalance=consistenthash + + + +**注解:** + +> @Reference(loadbalance = "consistenthash") + + + + **b、Dubbo负载均衡策略的引入阶段** + +Dubbo实现的是客户端负载均衡。关于服务接口代理类的实现,这里不做详细描述,可以参考官网: + +> 服务引入:http://dubbo.apache.org/zh-cn/docs/source_code_guide/refer-service.html。 + +在接口代理类生成、并且装配好后,服务的调用基本是这样一个流程:proxy -> MockClusterInvoker -> 集群策略(如:FailoverClusterInvoker) -> 根据选定的负载均衡策略确定选定的远程调用对象Invoker。 + +**负载均衡策略的初始化**是在AbstractClusterInvoker中的initLoadBalance方法中初始化的: + +```java +protected LoadBalance initLoadBalance(List> invokers, Invocation invocation) { +if (CollectionUtils.isNotEmpty(invokers)) { +return ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(invokers.get(0).getUrl() +.getMethodParameter(RpcUtils.getMethodName(invocation), LOADBALANCE_KEY, DEFAULT_LOADBALANCE)); +} else { +return ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(DEFAULT_LOADBALANCE); +} +} +``` + +这部分代码逻辑分为两部分: + +1、获取调用方法所配置的LOADBALANCE_KEY属性的值,LOADBALANCE_KEY这个常量的实际值为:loadbalance,即为我们的所配置的属性; + +2、利用SPI机制来初始化并加载该值所代表的负载均衡策略。 + + + +所有的负载均衡策略都会继承LoadBalance接口。在各种集群策略中,最终都会调用AbstractClusterInvoker的select方法,而AbstractClusterInvoker会在doSelect中,**调用LoadBalance的select方法,这里即开始了负载均衡策略的执行。** \ No newline at
[dubbo-website] branch asf-site updated: Automated deployment: Sat Mar 7 16:22:01 UTC 2020 50b73d9457e3fec8a5105ac94385e1873154a2cc
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/dubbo-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 31fc314 Automated deployment: Sat Mar 7 16:22:01 UTC 2020 50b73d9457e3fec8a5105ac94385e1873154a2cc 31fc314 is described below commit 31fc314d6436ef23056fa6b9be916339bf5fe0e5 Author: lovepoem AuthorDate: Sat Mar 7 16:22:01 2020 + Automated deployment: Sat Mar 7 16:22:01 UTC 2020 50b73d9457e3fec8a5105ac94385e1873154a2cc --- en-us/docs/developers/developers_dev.html | 7 +++ en-us/docs/developers/developers_dev.json | 2 +- zh-cn/docs/developers/developers_dev.html | 7 +++ zh-cn/docs/developers/developers_dev.json | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/en-us/docs/developers/developers_dev.html b/en-us/docs/developers/developers_dev.html index 33fe7d7..3952f2c 100644 --- a/en-us/docs/developers/developers_dev.html +++ b/en-us/docs/developers/developers_dev.html @@ -292,6 +292,13 @@ Committer +8 + +zouyx +Yixian Zou +Shein +Committer ++8 + Contributors diff --git a/en-us/docs/developers/developers_dev.json b/en-us/docs/developers/developers_dev.json index 7a61044..c733e23 100644 --- a/en-us/docs/developers/developers_dev.json +++ b/en-us/docs/developers/developers_dev.json @@ -1,6 +1,6 @@ { "filename": "developers_dev.md", - "__html": "Developers\nThis page shows Dubbo developers. Please file PR to add or change items.\nCommitters\n\n\n\nApache ID\nName\nOrganization\nRole\nTimeZone\n\n\n\n\njmclean\nJustin Mclean\nApache\nMentor\n+11\n\n\nmarkt\nMark Thomas\nApache\nMentor\n+0\n\n\nwav [...] + "__html": "Developers\nThis page shows Dubbo developers. Please file PR to add or change items.\nCommitters\n\n\n\nApache ID\nName\nOrganization\nRole\nTimeZone\n\n\n\n\njmclean\nJustin Mclean\nApache\nMentor\n+11\n\n\nmarkt\nMark Thomas\nApache\nMentor\n+0\n\n\nwav [...] "link": "/en-us/docs/developers/developers_dev.html", "meta": {} } \ No newline at end of file diff --git a/zh-cn/docs/developers/developers_dev.html b/zh-cn/docs/developers/developers_dev.html index 3de3a56..048eb83 100644 --- a/zh-cn/docs/developers/developers_dev.html +++ b/zh-cn/docs/developers/developers_dev.html @@ -292,6 +292,13 @@ Committer +8 + +zouyx +Yixian Zou +Shein +Committer ++8 + 贡献者 diff --git a/zh-cn/docs/developers/developers_dev.json b/zh-cn/docs/developers/developers_dev.json index 40fe9f8..3838c6f 100644 --- a/zh-cn/docs/developers/developers_dev.json +++ b/zh-cn/docs/developers/developers_dev.json @@ -1,6 +1,6 @@ { "filename": "developers_dev.md", - "__html": "开发人员\n本页面展示了Dubbo的开发团队。请通过提交PR的方式把自己的信息添加到列表上。注:排名不分先后\n提交者\n\n\n\nApache ID\nName\nOrganization\nRole\nTimeZone\n\n\n\n\njmclean\nJustin Mclean\nApache\nMentor\n+11\n\n\nmarkt\nMark Thomas\nApache\nMentor\n+0\n\n\nwave\nDave Fisher\nApa [...] + "__html": "开发人员\n本页面展示了Dubbo的开发团队。请通过提交PR的方式把自己的信息添加到列表上。注:排名不分先后\n提交者\n\n\n\nApache ID\nName\nOrganization\nRole\nTimeZone\n\n\n\n\njmclean\nJustin Mclean\nApache\nMentor\n+11\n\n\nmarkt\nMark Thomas\nApache\nMentor\n+0\n\n\nwave\nDave Fisher\nApa [...] "link": "/zh-cn/docs/developers/developers_dev.html", "meta": {} } \ No newline at end of file
[dubbo] branch master updated: polish code of DubboShutdownHook (#5835)
This is an automated email from the ASF dual-hosted git repository. tswstarplanet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo.git The following commit(s) were added to refs/heads/master by this push: new 9fb69a5 polish code of DubboShutdownHook (#5835) 9fb69a5 is described below commit 9fb69a5c078064c76640735afb86148eaabace5c Author: tswstarplanet AuthorDate: Sun Mar 8 00:19:27 2020 +0800 polish code of DubboShutdownHook (#5835) --- .../src/main/java/org/apache/dubbo/config/DubboShutdownHook.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 50f2011..56dab50 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 @@ -89,7 +89,7 @@ public class DubboShutdownHook extends Thread { * Register the ShutdownHook */ public void register() { -if (!registered.get() && registered.compareAndSet(false, true)) { +if (registered.compareAndSet(false, true)) { DubboShutdownHook dubboShutdownHook = getDubboShutdownHook(); Runtime.getRuntime().addShutdownHook(dubboShutdownHook); dispatch(new DubboShutdownHookRegisteredEvent(dubboShutdownHook)); @@ -100,7 +100,7 @@ public class DubboShutdownHook extends Thread { * Unregister the ShutdownHook */ public void unregister() { -if (registered.get() && registered.compareAndSet(true, false)) { +if (registered.compareAndSet(true, false)) { DubboShutdownHook dubboShutdownHook = getDubboShutdownHook(); Runtime.getRuntime().removeShutdownHook(dubboShutdownHook); dispatch(new DubboShutdownHookUnregisteredEvent(dubboShutdownHook));
[dubbo] branch master updated: fix wrong telnet command package(#5690) (#5815)
This is an automated email from the ASF dual-hosted git repository. crazyhzm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo.git The following commit(s) were added to refs/heads/master by this push: new b5cc276 fix wrong telnet command package(#5690) (#5815) b5cc276 is described below commit b5cc276c25a254bd1c44869a861e63f86b27cc3a Author: xylsh AuthorDate: Sat Mar 7 23:16:40 2020 +0800 fix wrong telnet command package(#5690) (#5815) --- .../org.apache.dubbo.remoting.telnet.TelnetHandler | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dubbo-plugin/dubbo-qos/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.telnet.TelnetHandler b/dubbo-plugin/dubbo-qos/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.telnet.TelnetHandler index 9911163..0ce7b09 100644 --- a/dubbo-plugin/dubbo-qos/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.telnet.TelnetHandler +++ b/dubbo-plugin/dubbo-qos/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.telnet.TelnetHandler @@ -1,9 +1,9 @@ -ls=org.apache.dubbo.rpc.protocol.dubbo.telnet.ListTelnetHandler -ps=org.apache.dubbo.rpc.protocol.dubbo.telnet.PortTelnetHandler -cd=org.apache.dubbo.rpc.protocol.dubbo.telnet.ChangeTelnetHandler -pwd=org.apache.dubbo.rpc.protocol.dubbo.telnet.CurrentTelnetHandler -invoke=org.apache.dubbo.rpc.protocol.dubbo.telnet.InvokeTelnetHandler -trace=org.apache.dubbo.rpc.protocol.dubbo.telnet.TraceTelnetHandler -count=org.apache.dubbo.rpc.protocol.dubbo.telnet.CountTelnetHandler -select=org.apache.dubbo.rpc.protocol.dubbo.telnet.SelectTelnetHandler -shutdown=org.apache.dubbo.rpc.protocol.dubbo.telnet.ShutdownTelnetHandler \ No newline at end of file +ls=org.apache.dubbo.qos.legacy.ListTelnetHandler +ps=org.apache.dubbo.qos.legacy.PortTelnetHandler +cd=org.apache.dubbo.qos.legacy.ChangeTelnetHandler +pwd=org.apache.dubbo.qos.legacy.CurrentTelnetHandler +invoke=org.apache.dubbo.qos.legacy.InvokeTelnetHandler +trace=org.apache.dubbo.qos.legacy.TraceTelnetHandler +count=org.apache.dubbo.qos.legacy.CountTelnetHandler +select=org.apache.dubbo.qos.legacy.SelectTelnetHandler +shutdown=org.apache.dubbo.qos.legacy.ShutdownTelnetHandler \ No newline at end of file
[dubbo-go] branch feature/rest updated: fix haven't read error msg
This is an automated email from the ASF dual-hosted git repository. flycash pushed a commit to branch feature/rest in repository https://gitbox.apache.org/repos/asf/dubbo-go.git The following commit(s) were added to refs/heads/feature/rest by this push: new b40361e fix haven't read error msg new 182a367 Merge pull request #392 from Patrick0308/rest_protocol b40361e is described below commit b40361e9088ee565f0c965a81527fc503d626239 Author: Patrick AuthorDate: Fri Mar 6 20:29:58 2020 +0800 fix haven't read error msg --- protocol/rest/rest_client/resty_client.go | 16 +--- protocol/rest/rest_invoker_test.go| 12 protocol/rest/rest_protocol_test.go | 5 + 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/protocol/rest/rest_client/resty_client.go b/protocol/rest/rest_client/resty_client.go index cdfddcf..88c3cc7 100644 --- a/protocol/rest/rest_client/resty_client.go +++ b/protocol/rest/rest_client/resty_client.go @@ -26,6 +26,10 @@ import ( ) import ( + perrors "github.com/pkg/errors" +) + +import ( "github.com/go-resty/resty/v2" ) @@ -65,16 +69,22 @@ func NewRestyClient(restOption *rest_interface.RestOptions) *RestyClient { } func (rc *RestyClient) Do(restRequest *rest_interface.RestRequest, res interface{}) error { - _, err := rc.client.R(). + r, err := rc.client.R(). SetHeader("Content-Type", restRequest.Consumes). SetHeader("Accept", restRequest.Produces). SetPathParams(restRequest.PathParams). SetQueryParams(restRequest.QueryParams). + SetHeaders(restRequest.Headers). SetBody(restRequest.Body). SetResult(res). - SetHeaders(restRequest.Headers). Execute(restRequest.Method, "http://"+path.Join(restRequest.Location, restRequest.Path)) - return err + if err != nil { + return perrors.WithStack(err) + } + if r.IsError() { + return perrors.New(r.String()) + } + return nil } func GetRestyClient(restOptions *rest_interface.RestOptions) rest_interface.RestClient { diff --git a/protocol/rest/rest_invoker_test.go b/protocol/rest/rest_invoker_test.go index d2e350e..2ec71b7 100644 --- a/protocol/rest/rest_invoker_test.go +++ b/protocol/rest/rest_invoker_test.go @@ -112,6 +112,14 @@ func TestRestInvoker_Invoke(t *testing.T) { QueryParamsMap: nil, Body: 0, } + methodConfigMap["GetUserFive"] = _interface.RestMethodConfig{ + InterfaceName: "", + MethodName:"GetUserFive", + Path: "/GetUserFive", + Produces: "*/*", + Consumes: "*/*", + MethodType:"GET", + } methodConfigMap["GetUser"] = _interface.RestMethodConfig{ InterfaceName: "", MethodName: "GetUser", @@ -175,6 +183,10 @@ func TestRestInvoker_Invoke(t *testing.T) { assert.NoError(t, res.Error()) assert.NotNil(t, res.Result()) assert.Equal(t, "username", res.Result().(*User).Name) + inv = invocation.NewRPCInvocationWithOptions(invocation.WithMethodName("GetUserFive"), invocation.WithReply(user)) + res = invoker.Invoke(context.Background(), inv) + assert.Error(t, res.Error(), "test error") + err = common.ServiceMap.UnRegister(url.Protocol, "com.ikurento.user.UserProvider") assert.NoError(t, err) } diff --git a/protocol/rest/rest_protocol_test.go b/protocol/rest/rest_protocol_test.go index 0c3628d..28250d0 100644 --- a/protocol/rest/rest_protocol_test.go +++ b/protocol/rest/rest_protocol_test.go @@ -19,6 +19,7 @@ package rest import ( "context" + "errors" "fmt" "strings" "testing" @@ -173,6 +174,10 @@ func (p *UserProvider) GetUserFour(ctx context.Context, user []interface{}, id s return u, nil } +func (p *UserProvider) GetUserFive(ctx context.Context, user []interface{}) (*User, error) { + return nil, errors.New("test error") +} + type User struct { Id int Time *time.Time
[dubbo-website] branch asf-site updated: Automated deployment: Sat Mar 7 16:23:13 UTC 2020 1c41196ff38c31a49f925910510849921386112a
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/dubbo-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 6905928 Automated deployment: Sat Mar 7 16:23:13 UTC 2020 1c41196ff38c31a49f925910510849921386112a 6905928 is described below commit 6905928fccfcd7d0d62f96010d027e09e9cb8618 Author: lovepoem AuthorDate: Sat Mar 7 16:23:13 2020 + Automated deployment: Sat Mar 7 16:23:13 UTC 2020 1c41196ff38c31a49f925910510849921386112a --- build/blog.js | 2 +- .../consistent-hash-balance-model.jpg | Bin 0 -> 29205 bytes .../consistent-hash-delete-node-model.jpg | Bin 0 -> 32314 bytes .../consistenthash/consistent-hash-init-model.jpg | Bin 0 -> 29515 bytes .../consistent-hash-new-node-model.jpg | Bin 0 -> 35015 bytes .../consistent-hash-request-model.jpg | Bin 0 -> 34165 bytes .../consistent-hash-virtual-node-model.jpg | Bin 0 -> 33019 bytes md_json/blog.json | 9 ++ .../blog/dubbo-consistent-hash-implementation.html | 96 + .../blog/dubbo-consistent-hash-implementation.json | 10 +++ zh-cn/blog/index.html | 2 +- 11 files changed, 117 insertions(+), 2 deletions(-) diff --git a/build/blog.js b/build/blog.js index dad8a76..c4d80e8 100644 --- a/build/blog.js +++ b/build/blog.js @@ -1,4 +1,4 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/build/",t(t.s=317 [...] +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/build/",t(t.s=317 [...] Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames diff --git a/img/blog/consistenthash/consistent-hash-balance-model.jpg b/img/blog/consistenthash/consistent-hash-balance-model.jpg new file mode 100644 index 000..9bcee0c Binary files /dev/null and b/img/blog/consistenthash/consistent-hash-balance-model.jpg differ diff --git a/img/blog/consistenthash/consistent-hash-delete-node-model.jpg b/img/blog/consistenthash/consistent-hash-delete-node-model.jpg new file mode 100644 index 000..a07e294 Binary files /dev/null and b/img/blog/consistenthash/consistent-hash-delete-node-model.jpg differ diff --git a/img/blog/consistenthash/consistent-hash-init-model.jpg b/img/blog/consistenthash/consistent-hash-init-model.jpg new file mode 100644 index 000..bcbbc00 Binary files /dev/null and b/img/blog/consistenthash/consistent-hash-init-model.jpg differ diff --git a/img/blog/consistenthash/consistent-hash-new-node-model.jpg b/img/blog/consistenthash/consistent-hash-new-node-model.jpg new file mode 100644 index 000..1af435b Binary files /dev/null and b/img/blog/consistenthash/consistent-hash-new-node-model.jpg differ diff --git a/img/blog/consistenthash/consistent-hash-request-model.jpg b/img/blog/consistenthash/consistent-hash-request-model.jpg new file mode 100644 index 000..fb5f3d4 Binary files /dev/null and b/img/blog/consistenthash/consistent-hash-request-model.jpg differ diff --git a/img/blog/consistenthash/consistent-hash-virtual-node-model.jpg b/img/blog/consistenthash/consistent-hash-virtual-node-model.jpg new file mode 100644 index 000..b9de63d Binary files /dev/null and b/img/blog/consistenthash/consistent-hash-virtual-node-model.jpg differ diff --git a/md_json/blog.json b/md_json/blog.json index 861d294..8e75d14 100644 --- a/md_json/blog.json +++ b/md_json/blog.json @@ -407,6 +407,15 @@ } }, { + "filename": "dubbo-consistent-hash-implementation.md", + "link": "/zh-cn/blog/dubbo-consistent-hash-implementation.html", + "meta": { +"title": "Dubbo一致性Hash负载均衡实现剖析", +"keywords": "Dubbo, Consistent Hash,一致性Hash,一致性哈希", +"description": "本文以一般的一致性Hash实现作为引子,详细剖析了Dubbo一致性Hash负载均衡算法的实现" + } +}, +{ "filename": "dubbo-context-information.md", "link": "/zh-cn/blog/dubbo-context-information.html", "meta": { diff
[dubbo] branch master updated: fix typo (#5834)
This is an automated email from the ASF dual-hosted git repository. tswstarplanet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo.git The following commit(s) were added to refs/heads/master by this push: new 4037b5d fix typo (#5834) 4037b5d is described below commit 4037b5d33e572b5c2904c469a04c62ca878bfaea Author: GungnirLaevatain <547992...@qq.com> AuthorDate: Sun Mar 8 15:29:52 2020 +0800 fix typo (#5834) --- .../src/main/java/org/apache/dubbo/remoting/etcd/jetcd/JEtcdClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/jetcd/JEtcdClient.java b/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/jetcd/JEtcdClient.java index 784b5a0..0da56fa 100644 --- a/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/jetcd/JEtcdClient.java +++ b/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/jetcd/JEtcdClient.java @@ -70,7 +70,7 @@ import static org.apache.dubbo.remoting.etcd.Constants.RETRY_PERIOD_KEY; import static org.apache.dubbo.remoting.etcd.jetcd.JEtcdClientWrapper.UTF_8; /** - * etct3 client. + * etcd3 client. */ public class JEtcdClient extends AbstractEtcdClient {