[dubbo-website] branch rd_sources deleted (was 84f58b6)
This is an automated email from the ASF dual-hosted git repository. wangxin pushed a change to branch rd_sources in repository https://gitbox.apache.org/repos/asf/dubbo-website.git. was 84f58b6 修改导航菜单链接错误的问题 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[dubbo-website] branch gh-pages deleted (was 09163c0)
This is an automated email from the ASF dual-hosted git repository. wangxin pushed a change to branch gh-pages in repository https://gitbox.apache.org/repos/asf/dubbo-website.git. was 09163c0 initial cut for new github pages for dubbo project The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[dubbo-website] branch asf-site-legacy deleted (was f55ba05)
This is an automated email from the ASF dual-hosted git repository. wangxin pushed a change to branch asf-site-legacy in repository https://gitbox.apache.org/repos/asf/dubbo-website.git. was f55ba05 Add download button. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[dubbo-admin] branch develop updated: 修复 注册中心使用配置中心group属性的bug (#442)
This is an automated email from the ASF dual-hosted git repository. min pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git The following commit(s) were added to refs/heads/develop by this push: new 9e81f94 修复 注册中心使用配置中心group属性的bug (#442) 9e81f94 is described below commit 9e81f94cf7e4de20cf51c1781fba269ffee1bd94 Author: aworker AuthorDate: Fri Jun 28 09:34:35 2019 +0800 修复 注册中心使用配置中心group属性的bug (#442) --- .../src/main/java/org/apache/dubbo/admin/config/ConfigCenter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/config/ConfigCenter.java b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/config/ConfigCenter.java index 2879559..5682f9c 100644 --- a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/config/ConfigCenter.java +++ b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/config/ConfigCenter.java @@ -101,7 +101,7 @@ public class ConfigCenter { } if (dynamicConfiguration == null) { if (StringUtils.isNotEmpty(registryAddress)) { -registryUrl = formUrl(registryAddress, configCenterGroup, username, password); +registryUrl = formUrl(registryAddress, registryGroup, username, password); dynamicConfiguration = ExtensionLoader.getExtensionLoader(GovernanceConfiguration.class).getExtension(registryUrl.getProtocol()); dynamicConfiguration.setUrl(registryUrl); dynamicConfiguration.init();
[dubbo-go.wiki] branch master updated: Updated notice of committing codes (markdown)
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.wiki.git The following commit(s) were added to refs/heads/master by this push: new 64c089b Updated notice of committing codes (markdown) 64c089b is described below commit 64c089b200a2637ad733065a16a173f2bf13566f Author: Xin.Zh AuthorDate: Fri Jun 28 00:02:43 2019 +0800 Updated notice of committing codes (markdown) --- notice-of-committing-codes.md | 4 1 file changed, 4 insertions(+) diff --git a/notice-of-committing-codes.md b/notice-of-committing-codes.md index 5e8f0c9..661ef1a 100644 --- a/notice-of-committing-codes.md +++ b/notice-of-committing-codes.md @@ -22,3 +22,7 @@ The title format of the pull request `MUST` follow the following rules: >- Start with `Dep:` for adding depending libs. >- Start with `Rem:` for removing feature/struct/function/member/files. +## 3. Go programming rules + +- 1 do not use a struct's outside its functions [#issue-101](https://github.com/apache/dubbo-go/issues/101); +- 2 do not use a Mutex/RWMutex:Lock() before invoke Mutex/RWMutex:Unlock() [#issue-101](https://github.com/apache/dubbo-go/issues/101);
[dubbo-go] branch master updated: Fix:fix test & some spelling problems
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.git The following commit(s) were added to refs/heads/master by this push: new 2b3b74f Fix:fix test & some spelling problems new 0c3a607 Merge pull request #107 from fangyincheng/services 2b3b74f is described below commit 2b3b74f24ae93ae9cfca5cb9a890dd966dc3b615 Author: fangyincheng AuthorDate: Thu Jun 27 20:07:03 2019 +0800 Fix:fix test & some spelling problems --- cluster/loadbalance/least_active.go | 2 +- config/service_config_test.go | 3 ++- protocol/dubbo/client_test.go | 6 +++--- protocol/dubbo/codec.go | 6 +++--- protocol/dubbo/dubbo_invoker_test.go | 2 +- protocol/dubbo/dubbo_protocol_test.go | 2 +- protocol/dubbo/listener.go| 2 +- protocol/jsonrpc/server.go| 4 +++- 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cluster/loadbalance/least_active.go b/cluster/loadbalance/least_active.go index d7d3056..695ca21 100644 --- a/cluster/loadbalance/least_active.go +++ b/cluster/loadbalance/least_active.go @@ -50,7 +50,7 @@ func (lb *leastActiveLoadBalance) Select(invokers []protocol.Invoker, invocation var ( leastActive int32 = -1 // The least active value of all invokers totalWeight int64 = 0 // The number of invokers having the same least active value (LEAST_ACTIVE) - firstWeight int64 = 0 // Initial value, used for comparision + firstWeight int64 = 0 // Initial value, used for comparison leastIndexes = make([]int, count) // The index of invokers having the same least active value (LEAST_ACTIVE) leastCount = 0 // The number of invokers having the same least active value (LEAST_ACTIVE) sameWeight = true // Every invoker has the same weight value? diff --git a/config/service_config_test.go b/config/service_config_test.go index 77cbbff..99835f6 100644 --- a/config/service_config_test.go +++ b/config/service_config_test.go @@ -122,7 +122,8 @@ func Test_Export(t *testing.T) { doinit() extension.SetProtocol("registry", GetProtocol) - for _, service := range providerConfig.Services { + for i := 0; i < len(providerConfig.Services); i++ { + service := providerConfig.Services[i] service.Implement({}) service.Export() assert.Condition(t, func() bool { diff --git a/protocol/dubbo/client_test.go b/protocol/dubbo/client_test.go index 1ea9e4f..f4a5f4a 100644 --- a/protocol/dubbo/client_test.go +++ b/protocol/dubbo/client_test.go @@ -40,7 +40,7 @@ func TestClient_CallOneway(t *testing.T) { proto, url := InitTest(t) c := { - pendingResponses: make(map[SequenceType]*PendingResponse), + pendingResponses: new(sync.Map), conf: *clientConf, } c.pool = newGettyRPCClientConnPool(c, clientConf.PoolSize, time.Duration(int(time.Second)*clientConf.PoolTTL)) @@ -57,7 +57,7 @@ func TestClient_Call(t *testing.T) { proto, url := InitTest(t) c := { - pendingResponses: make(map[SequenceType]*PendingResponse), + pendingResponses: new(sync.Map), conf: *clientConf, } c.pool = newGettyRPCClientConnPool(c, clientConf.PoolSize, time.Duration(int(time.Second)*clientConf.PoolTTL)) @@ -118,7 +118,7 @@ func TestClient_AsyncCall(t *testing.T) { proto, url := InitTest(t) c := { - pendingResponses: make(map[SequenceType]*PendingResponse), + pendingResponses: new(sync.Map), conf: *clientConf, } c.pool = newGettyRPCClientConnPool(c, clientConf.PoolSize, time.Duration(int(time.Second)*clientConf.PoolTTL)) diff --git a/protocol/dubbo/codec.go b/protocol/dubbo/codec.go index e9ced84..cb57fc8 100644 --- a/protocol/dubbo/codec.go +++ b/protocol/dubbo/codec.go @@ -40,9 +40,9 @@ const ( type CallType int32 const ( - CT_UNKOWN CallType = 0 - CT_OneWay CallType = 1 - CT_TwoWay CallType = 2 + CT_UNKNOWN CallType = 0 + CT_OneWay CallType = 1 + CT_TwoWay CallType = 2 ) diff --git a/protocol/dubbo/dubbo_invoker_test.go b/protocol/dubbo/dubbo_invoker_test.go index 4368bb4..182d6d8 100644 --- a/protocol/dubbo/dubbo_invoker_test.go +++ b/protocol/dubbo/dubbo_invoker_test.go @@ -36,7 +36,7 @@ func TestDubboInvoker_Invoke(t *testing.T) { proto, url := InitTest(t) c := { - pendingResponses: make(map[SequenceType]*PendingResponse), + pendingResponses:
[dubbo-website] branch asf-site updated: Website updated with ef991ad2e93c26914bc3976fb0df1f13c911e95e
This is an automated email from the ASF dual-hosted git repository. git-site-role 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 28f9a05 Website updated with ef991ad2e93c26914bc3976fb0df1f13c911e95e 28f9a05 is described below commit 28f9a0535755a3b5a7ddfd01a12d34308925569b Author: jenkins AuthorDate: Thu Jun 27 13:01:18 2019 + Website updated with ef991ad2e93c26914bc3976fb0df1f13c911e95e --- COMMIT_ID | 2 +- md_json/docs.json | 5 + .../configcenter/design.html} | 150 + zh-cn/docs/dev/configcenter/design.json| 6 + zh-cn/docs/user/configuration/config-center.html | 4 +- zh-cn/docs/user/configuration/config-center.json | 2 +- 6 files changed, 77 insertions(+), 92 deletions(-) diff --git a/COMMIT_ID b/COMMIT_ID index 76844fd..783218c 100644 --- a/COMMIT_ID +++ b/COMMIT_ID @@ -1 +1 @@ -d5b2314946d78ebc3fd84e053067ee2edb14ac66 +ef991ad2e93c26914bc3976fb0df1f13c911e95e diff --git a/md_json/docs.json b/md_json/docs.json index bc30b12..a2ba31e 100644 --- a/md_json/docs.json +++ b/md_json/docs.json @@ -1086,6 +1086,11 @@ "meta": {} }, { + "filename": "design.md", + "link": "/zh-cn/docs/dev/configcenter/design.html", + "meta": {} +}, +{ "filename": "contract.md", "link": "/zh-cn/docs/dev/contract.html", "meta": {} diff --git a/zh-cn/docs/user/configuration/config-center.html b/zh-cn/docs/dev/configcenter/design.html similarity index 78% copy from zh-cn/docs/user/configuration/config-center.html copy to zh-cn/docs/dev/configcenter/design.html index 29f69d3..7abf64a 100644 --- a/zh-cn/docs/user/configuration/config-center.html +++ b/zh-cn/docs/dev/configcenter/design.html @@ -4,111 +4,85 @@ - - + + - config-center + design - En配置中心(v2.7.0)在Dubbo中承担两个职责: + En设计目的 +配置中心的核心功能是作为Key-Value存储,Dubbo框架告知配置中心其关心的key,配置中心返回该key对应的value值。 +按照应用场景划分,配置中心在Dubbo框架中主要承担以下职责: + +作为外部化配置中心,即存储dubbo.properties配置文件,此时,key值通常为文件名如dubbo.properties,value则为配置文件内容。 +存储单个配置项,如各种开关项、常量值等。 +存储服务治理规则,此时key通常按照服务名+规则类型的格式来组织,而value则为具体的治理规则。 + +为了进一步实现对key-value的分组管理,Dubbo的配置中心还加入了namespace、group的概念,这些概念在很多专业的第三方配置中心中都有体现,通常情况下,namespace用来隔离不同的租户,group用来对统一租户的key集合做分组。 +当前,Dubbo配置中心实现了对Zookeeper、Nacos、Etcd、Consul、Apollo的对接,接下来我们具体看一下Dubbo抽象的配置中心是怎么映射到具体的第三方实现中的。 +实现原理 +Zookeeper +zookeeper提供了一个树状的存储模型,其实现原理如下: + +namespace, group, key等分别对应不同层级的ZNode节点,而value则作为根ZNode节点的值存储。 -外部化配置。启动配置的集中式存储 (简单理解为dubbo.properties的外部化存储)。 -服务治理。服务治理规则的存储与通知。 - -启用动态配置(以Zookeeper为例,可查看动态配置配置项详解): -dubbo:config-center address="zookeeper://127.0.0.1:2181"/ - -或者 -dubbo.config-center.address=zookeeper://127.0.0.1:2181 - -或者 -ConfigCenterConfig configCenter = new ConfigCenterConfig(); -configCenter.setAddress("zookeeper://127.0.0.1:2181"); - - -为了兼容2.6.x版本配置,在使用Zookeeper作为注册中心,且没有显示配置配置中心的情况下,Dubbo框架会默认将此Zookeeper用作配置中心,但将只作服务治理用途。 - -外部化配置 -外部化配置目的之一是实现配置的集中式管理,这部分业界已经有很多成熟的专业配置系统如Apollo, Nacos等,Dubbo所做的主要是保证能配合这些系统正常工作。 -外部化配置和其他本地配置在内容和格式上并无区别,可以简单理解为dubbo.properties的外部化存储,配置中心更适合将一些公共配置如注册中心、元数据中心配置等抽取以便做集中管理。 -# 将注册中心地址、元数据中心地址等配置集中管理,可以做到统一环境、减少开发侧感知。 -dubbo.registry.address=zookeeper://127.0.0.1:2181 -dubbo.registry.simplified=true - -dubbo.metadataReport.address=zookeeper://127.0.0.1:2181 - -dubbo.protocol.name=dubbo -dubbo.protocol.port=20880 - -dubbo.application.qos.port=3 - + +外部化配置中心 dubbo.properties + +上图展示了两个不同作用域的dubbo.properties文件在zookeeper中的存储结构: -优先级 +命名空间namespace都为:dubbo +分组group:全局级别为dubbo,所有应用共享;应用级别为应用名demo-provider,只对改应用生效 +key:dubbo.properties -外部化配置默认较本地配置有更高的优先级,因此这里配置的内容会覆盖本地配置值,关于各配置形式间的覆盖关系有单独一章说明,你也可通过以下选项调整配置中心的优先级: --Ddubbo.configCenter.highestPriority=false - + + +单个配置项 + +设置优雅停机事件为15000: -作用域 +命名空间namespace:dubbo +分组group:dubbo +key:dubbo.service.shutdown.wait=15000 -外部化配置有全局和应用两个级别,全局配置是所有应用共享的,应用级配置是由每个应用自己维护且只对自身可见的。 -当前已支持的扩展实现有Zookeeper、Apollo。 -Zookeeper -dubbo:config-center address="zookeeper://127.0.0.1:2181"/ - -默认所有的配置都存储在/dubbo/config节点,具体节点结构图如下: - + + +服务治理规则 + +上图展示了一条应用级别的条件路由规则: -namespace,用于不同配置的环境隔离。 -config,Dubbo约定的固定节点,不可更改,所有配置和服务治理规则都存储在此节点下。 -dubbo/application,分别用来隔离全局配置、应用级别配置:dubbo是默认group值,application对应应用名 -dubbo.properties,此节点的node value存储具体配置内容 +命名空间namespace:dubbo +分组group:dubbo +key:governance-conditionrouter-consumer.condition-router,其中governance-conditionrouter-consumer为应用名,condition-router代表条件路由 -Apollo -dubbo:config-center protocol="apollo" address="127.0.0.1:2181"/ - -Apollo中的一个核心概念是命名空间 - namespace(和上面zookeeper的namespace概念不同),在这里全局和应用级别配置就是通过命名空间来区分的。 -默认情况下,Dubbo会从名叫dubbo的命名空间中读取全局配置(dubbo:config-center namespace=your namespace) - -而应用自有的配置,会从application命名空间读取 - -注意:当前dubbo.properties是作为一个key存储在Apollo
[dubbo-go] branch release created (now 569562c)
This is an automated email from the ASF dual-hosted git repository. alexstocks pushed a change to branch release in repository https://gitbox.apache.org/repos/asf/dubbo-go.git. at 569562c Merge pull request #106 from fangyincheng/services No new revisions were added by this update.
[dubbo-go] branch develop updated (fc42a4b -> 569562c)
This is an automated email from the ASF dual-hosted git repository. alexstocks pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/dubbo-go.git. from fc42a4b Fix: fix bug when go-client calling java-client by p2p add 2a62276 Mod: import path github.com/dubbo/go-for-apache-dubbo -> github.com/apache/dubbo-go add a42f455 Merge pull request #70 from AlexStocks/master add 15aee18 Mod: change license add 8b3fdae Merge pull request #72 from AlexStocks/master add ec67719 Ref: refactor code in registry.zookeeper, create remoting/zookeeper to code reuse in config_center for zk add d7b9412 Mod: format the code & add apache license add 8146d1d Fix: change go-for-apache-dubbo to dubbo-go as issue #74 add 2e3dfb1 Merge pull request #77 from AlexStocks/master add 6d3f230 Mod:go fmt add fdbd6d3 Mrg:merge upstream/master add 3117f3b Mod:update readme add 0541c85 Fix:fix conflict add d109389 Merge pull request #75 from fangyincheng/develop add 5bde923 Modify Chinese notes (#81) add 9f1a565 Fix:issue #68 add e6882ec Merge pull request #82 from fangyincheng/fix-exception add 4f7ef9d Imp: add Client.GetPendingResponse to limit the lock scope (#83) add 7586d67 Mod: resolve conflict add cfc316c Mod: DataListener move to common add 0039ac6 Mod: DataListener move to remoting add a8596b5 Fmt:format code add 4f779d4 Fix:big pkg and hessian2 add 5e3e439 Mod:big pkg ut add ebb1a02 Fix: readHeader error add 9f0a843 Mod:del a temple var add 2954fad Fix:heartbeat and exception add fafa25e Merge pull request #84 from fangyincheng/fix-hessian2 add 4a91a50 fix issue88 add 30fb7e5 fix issue88 based on os info add adb034d new import clause for third-party package add 51406b3 Merge pull request #89 from dubbo-x/issue88 add d8763ab Mod:resolve conflict add d15a274 Mod:format code add f16fce4 Merge pull request #87 from hxmhlt/master add d96662f round robin loadbalance add 747ff5b register NewRoundRobinLoadBalance add 478533a format code add 329c297 format code add 8fb1ce9 fix bug & unit test. add 872fa6f fix bug & unit test. add c648b81 多个变量合并到var申明 add b3c7591 Merge branch 'master' into loadbalance_round_robin add d081c07 merge from master. add 28d3c8d Merge pull request #66 from zonghaishang/loadbalance_round_robin add 8459bec update readme.md add 17d73c5 Merge pull request #91 from zonghaishang/update_readme add 83409ca register NewLeastActiveLoadBalance add a97fa47 format code add bb3d59c Merge branch 'master' into loadbalance_leastactive add 51651d6 merge from master. add dcd2556 refactor & unit test add 87a797b Merge branch 'master' into loadbalance_leastactive add 966ae48 fix bug & unit test. add 417117e remove `github.com/dubbo/go-for-apache-dubbo v1.0.0` from go.md & go.sum file. add b2585fc refactor imports. add 2b5f5e4 Merge pull request #65 from zonghaishang/loadbalance_leastactive add 6f9acee fix issue #71 add 47afe5a Merge pull request #93 from wongoo/fix-issue71 add 088fd67 Fix: for p2p bug add 3c4b066 Mod:modify some log info add 1038cff Mod:read me add 0032f9c Merge pull request #94 from hxmhlt/master add ea6c157 Fix: alexstocks/getty issue 18 add c8554c3 Merge pull request #96 from divebomb/master add 36ff235 Fix: close client before close sessions to defeat client stop too slowly when got a signal add 23f39b2 Merge pull request #97 from divebomb/master add 9759f4b Imp:improve config.Load and call mode add 84e5f22 Mrg:merge upstream/master add 22b31ae Mod:modify examples/README.md, fix issue #79 add 19398a5 Imp:support lowercase function on the provider add bf9549e Imp:support no request, response and to return nil request, response add 966c138 Merge remote-tracking branch 'upstream/master' into imp add 04370a5 Mod:format add 10c35d7 Merge remote-tracking branch 'upstream/master' into imp add 89f54b9 Mrg:merge upstream add 4e298b0 Fix: support multi-service add 2468348 Mod:format add 05b6892 Fix:fix bug add 72f5336 Fix:default version add 10d0f0f Merge pull request #98 from fangyincheng/imp add 4833a6f Fix:Lock bug add 569562c Merge pull request #106 from fangyincheng/services No new revisions were added by this update. Summary of changes: README.md | 27 +- README_CN.md | 140 - cluster/cluster.go | 33 +- cluster/cluster_impl/base_cluster_invoker.go | 39 +-- cluster/cluster_impl/failover_cluster.go | 38 +--
[dubbo-go] branch feature/dubbo-etcd-k8s deleted (was 8d0d59e)
This is an automated email from the ASF dual-hosted git repository. alexstocks pushed a change to branch feature/dubbo-etcd-k8s in repository https://gitbox.apache.org/repos/asf/dubbo-go.git. was 8d0d59e etcd3 registry This change permanently discards the following revisions: discard 8d0d59e etcd3 registry discard 3dfbfbd etcd3 registry discard 0e585c9 etcd3 registry discard b159aa2 etcd3 registry discard aa092ac etcd3 registry discard 855a07d etcd3 registry
[dubbo-go] branch master updated: Fix:Lock bug
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.git The following commit(s) were added to refs/heads/master by this push: new 4833a6f Fix:Lock bug new 569562c Merge pull request #106 from fangyincheng/services 4833a6f is described below commit 4833a6f483e8c63ec343f89307dac82c28c4caad Author: fangyincheng AuthorDate: Thu Jun 27 17:42:03 2019 +0800 Fix:Lock bug --- protocol/dubbo/client.go | 24 ++-- protocol/dubbo/codec.go | 6 +++--- protocol/dubbo/readwriter.go | 2 -- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/protocol/dubbo/client.go b/protocol/dubbo/client.go index d6155b6..72abcda 100644 --- a/protocol/dubbo/client.go +++ b/protocol/dubbo/client.go @@ -148,14 +148,13 @@ type Client struct { pool *gettyRPCClientPool sequence atomic.Uint64 - pendingLock sync.RWMutex - pendingResponses map[SequenceType]*PendingResponse + pendingResponses *sync.Map } func NewClient() *Client { c := { - pendingResponses: make(map[SequenceType]*PendingResponse), + pendingResponses: new(sync.Map), conf: *clientConf, } c.pool = newGettyRPCClientConnPool(c, clientConf.PoolSize, time.Duration(int(time.Second)*clientConf.PoolTTL)) @@ -201,13 +200,6 @@ func (c *Client) AsyncCall(addr string, svcUrl common.URL, method string, args i return perrors.WithStack(c.call(CT_TwoWay, addr, svcUrl, method, args, reply, callback, copts)) } -func (c *Client) GetPendingResponse(seq SequenceType) *PendingResponse { - c.pendingLock.RLock() - defer c.pendingLock.RUnlock() - - return c.pendingResponses[SequenceType(seq)] -} - func (c *Client) call(ct CallType, addr string, svcUrl common.URL, method string, args, reply interface{}, callback AsyncCallback, opts CallOptions) error { @@ -330,20 +322,16 @@ func (c *Client) transfer(session getty.Session, pkg *DubboPackage, } func (c *Client) addPendingResponse(pr *PendingResponse) { - c.pendingLock.Lock() - defer c.pendingLock.Unlock() - c.pendingResponses[SequenceType(pr.seq)] = pr + c.pendingResponses.Store(SequenceType(pr.seq), pr) } func (c *Client) removePendingResponse(seq SequenceType) *PendingResponse { - c.pendingLock.Lock() - defer c.pendingLock.Unlock() if c.pendingResponses == nil { return nil } - if presp, ok := c.pendingResponses[seq]; ok { - delete(c.pendingResponses, seq) - return presp + if presp, ok := c.pendingResponses.Load(seq); ok { + c.pendingResponses.Delete(seq) + return presp.(*PendingResponse) } return nil } diff --git a/protocol/dubbo/codec.go b/protocol/dubbo/codec.go index 9551c2b..e9ced84 100644 --- a/protocol/dubbo/codec.go +++ b/protocol/dubbo/codec.go @@ -88,11 +88,11 @@ func (p *DubboPackage) Unmarshal(buf *bytes.Buffer, opts ...interface{}) error { return perrors.Errorf("opts[0] is not of type *Client") } - pendingRsp := client.GetPendingResponse(SequenceType(p.Header.ID)) - if pendingRsp == nil { + pendingRsp, ok := client.pendingResponses.Load(SequenceType(p.Header.ID)) + if !ok { return perrors.Errorf("client.GetPendingResponse(%v) = nil", p.Header.ID) } else { - p.Body = {RspObj: pendingRsp.reply} + p.Body = {RspObj: pendingRsp.(*PendingResponse).reply} } } diff --git a/protocol/dubbo/readwriter.go b/protocol/dubbo/readwriter.go index 529aa75..042b878 100644 --- a/protocol/dubbo/readwriter.go +++ b/protocol/dubbo/readwriter.go @@ -46,8 +46,6 @@ func NewRpcClientPackageHandler(client *Client) *RpcClientPackageHandler { } func (p *RpcClientPackageHandler) Read(ss getty.Session, data []byte) (interface{}, int, error) { - p.client.pendingLock.RLock() - defer p.client.pendingLock.RUnlock() pkg := {} buf := bytes.NewBuffer(data)
[dubbo-website] 02/02: [Doc] Dubbo's Config Center model corresponding to different thirdparty products (#388)
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/dubbo-website.git commit ef991ad2e93c26914bc3976fb0df1f13c911e95e Author: ken.lj AuthorDate: Thu Jun 27 16:20:44 2019 +0800 [Doc] Dubbo's Config Center model corresponding to different thirdparty products (#388) --- docs/zh-cn/dev/configcenter/design.md | 82 ++ img/configcenter_nacos_model.jpg | Bin 0 -> 78352 bytes img/configcenter_zk_model.jpg | Bin 0 -> 189160 bytes img/configcenter_zk_properties.jpg| Bin 0 -> 92946 bytes img/configcenter_zk_rule.jpg | Bin 0 -> 131167 bytes img/configcenter_zk_singleitem.jpg| Bin 0 -> 53837 bytes 6 files changed, 82 insertions(+) diff --git a/docs/zh-cn/dev/configcenter/design.md b/docs/zh-cn/dev/configcenter/design.md new file mode 100644 index 000..ae521a8 --- /dev/null +++ b/docs/zh-cn/dev/configcenter/design.md @@ -0,0 +1,82 @@ +# Dubbo配置中心 + +## 设计目的 +配置中心的核心功能是作为Key-Value存储,Dubbo框架告知配置中心其关心的key,配置中心返回该key对应的value值。 + +按照应用场景划分,配置中心在Dubbo框架中主要承担以下职责: + +- 作为外部化配置中心,即存储dubbo.properties配置文件,此时,key值通常为文件名如dubbo.properties,value则为配置文件内容。 +- 存储单个配置项,如各种开关项、常量值等。 +- 存储服务治理规则,此时key通常按照"服务名+规则类型"的格式来组织,而value则为具体的治理规则。 + +为了进一步实现对key-value的分组管理,Dubbo的配置中心还加入了namespace、group的概念,这些概念在很多专业的第三方配置中心中都有体现,通常情况下,namespace用来隔离不同的租户,group用来对统一租户的key集合做分组。 + +当前,Dubbo配置中心实现了对Zookeeper、Nacos、Etcd、Consul、Apollo的对接,接下来我们具体看一下Dubbo抽象的配置中心是怎么映射到具体的第三方实现中的。 + +## 实现原理 + +### Zookeeper + +zookeeper提供了一个树状的存储模型,其实现原理如下: + +![image-20190127225608553](/img/configcenter_zk_model.jpg) + +namespace, group, key等分别对应不同层级的ZNode节点,而value则作为根ZNode节点的值存储。 + +1. 外部化配置中心 dubbo.properties + + ![image-20190127225608553](/img/configcenter_zk_properties.jpg) + + 上图展示了两个不同作用域的dubbo.properties文件在zookeeper中的存储结构: + - 命名空间namespace都为:dubbo + - 分组group:全局级别为dubbo,所有应用共享;应用级别为应用名demo-provider,只对改应用生效 + - key:dubbo.properties + +2. 单个配置项 + + ![image-20190127225608553](/img/configcenter_zk_singleitem.jpg) + + 设置优雅停机事件为15000: + - 命名空间namespace:dubbo + - 分组group:dubbo + - key:dubbo.service.shutdown.wait=15000 + +3. 服务治理规则 + +![image-20190127225608553](/img/configcenter_zk_rule.jpg) + +上图展示了一条应用级别的条件路由规则: + +- 命名空间namespace:dubbo +- 分组group:dubbo +- key:governance-conditionrouter-consumer.condition-router,其中governance-conditionrouter-consumer为应用名,condition-router代表条件路由 + + +> 注意: +> +> Dubbo同时支持应用、服务两种粒度的服务治理规则,对于这两种粒度,其key取值规则如下: +> * 应用粒度 {应用名 + 规则后缀}。如: `demo-application.configurators`、`demo-application.tag-router`等 +> * 服务粒度 {服务接口名:[服务版本]:[服务分组] + 规则后缀},其中服务版本、服务分组是可选的,如果它们有配置则在key中体现,没被配置则用":"占位。如 +> `org.apache.dubbo.demo.DemoService::.configurators`、`org.apache.dubbo.demo.DemoService:1.0.0:group1.configurators` + +### Etcd & Consul + +Etcd和Consul本质上也是一种类似zookeeper的树状存储结构,实现请参考zookeeper。 + +### Nacos + +Nacos作为一个专业的第三方配置中心,拥有专门为配置中心设计的存储结构,包括内置的namespace、group、dataid等概念。并且这几个概念基本上与Dubbo框架抽象的配置中心是一一对应的。 + +与Zookeeper实现的对应关系如下: + +![image-20190127225608553](/img/configcenter_nacos_model.jpg) + +参考上文关于zookeeper实现中描述的示例,这里的dataid可能为: +* 外部化配置中心:dubbo.properties +* 单个配置项:dubbo.service.shutdown.wait +* 服务治理规则:org.apache.dubbo.demo.DemoService:1.0.0:group1.configurators + +### Apollo + +Apollo与Nacos类似,请参考动态配置中心使用文档中关于Apollo部分的描述。 + diff --git a/img/configcenter_nacos_model.jpg b/img/configcenter_nacos_model.jpg new file mode 100644 index 000..b6d1011 Binary files /dev/null and b/img/configcenter_nacos_model.jpg differ diff --git a/img/configcenter_zk_model.jpg b/img/configcenter_zk_model.jpg new file mode 100644 index 000..33a1b55 Binary files /dev/null and b/img/configcenter_zk_model.jpg differ diff --git a/img/configcenter_zk_properties.jpg b/img/configcenter_zk_properties.jpg new file mode 100644 index 000..0f95ca8 Binary files /dev/null and b/img/configcenter_zk_properties.jpg differ diff --git a/img/configcenter_zk_rule.jpg b/img/configcenter_zk_rule.jpg new file mode 100644 index 000..f39da96 Binary files /dev/null and b/img/configcenter_zk_rule.jpg differ diff --git a/img/configcenter_zk_singleitem.jpg b/img/configcenter_zk_singleitem.jpg new file mode 100644 index 000..641ffee Binary files /dev/null and b/img/configcenter_zk_singleitem.jpg differ
[dubbo-website] branch master updated (d5b2314 -> ef991ad)
This is an automated email from the ASF dual-hosted git repository. liujun pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-website.git. from d5b2314 Fix registry protocol description (#407) new f1df26c Correct word separator to '-' (#417) new ef991ad [Doc] Dubbo's Config Center model corresponding to different thirdparty products (#388) The 2 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: docs/zh-cn/dev/configcenter/design.md | 82 + docs/zh-cn/user/configuration/config-center.md | 4 +- img/configcenter_nacos_model.jpg | Bin 0 -> 78352 bytes img/configcenter_zk_model.jpg | Bin 0 -> 189160 bytes img/configcenter_zk_properties.jpg | Bin 0 -> 92946 bytes img/configcenter_zk_rule.jpg | Bin 0 -> 131167 bytes img/configcenter_zk_singleitem.jpg | Bin 0 -> 53837 bytes 7 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 docs/zh-cn/dev/configcenter/design.md create mode 100644 img/configcenter_nacos_model.jpg create mode 100644 img/configcenter_zk_model.jpg create mode 100644 img/configcenter_zk_properties.jpg create mode 100644 img/configcenter_zk_rule.jpg create mode 100644 img/configcenter_zk_singleitem.jpg
[dubbo-website] 01/02: Correct word separator to '-' (#417)
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/dubbo-website.git commit f1df26c55f215b156a9b5f05419dddb9de0f77eb Author: ken.lj AuthorDate: Thu Jun 27 16:29:45 2019 +0800 Correct word separator to '-' (#417) --- docs/zh-cn/user/configuration/config-center.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh-cn/user/configuration/config-center.md b/docs/zh-cn/user/configuration/config-center.md index ca5af6a..db5c419 100644 --- a/docs/zh-cn/user/configuration/config-center.md +++ b/docs/zh-cn/user/configuration/config-center.md @@ -40,7 +40,7 @@ configCenter.setAddress("zookeeper://127.0.0.1:2181"); dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.registry.simplified=true -dubbo.metadataReport.address=zookeeper://127.0.0.1:2181 +dubbo.metadata-report.address=zookeeper://127.0.0.1:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20880 @@ -54,7 +54,7 @@ dubbo.application.qos.port=3 外部化配置默认较本地配置有更高的优先级,因此这里配置的内容会覆盖本地配置值,关于[各配置形式间的覆盖关系](./configuration-load-process.md)有单独一章说明,你也可通过以下选项调整配置中心的优先级: ```properties - -Ddubbo.configCenter.highestPriority=false + -Ddubbo.config-center.highest-priority=false ``` - 作用域
[dubbo-website] branch asf-site updated: Correct word separator to '-' (#417)
This is an automated email from the ASF dual-hosted git repository. liujun 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 f3826c2 Correct word separator to '-' (#417) f3826c2 is described below commit f3826c20e2d311b9950f3f34f36ce868b1c91ccb Author: ken.lj AuthorDate: Thu Jun 27 16:29:45 2019 +0800 Correct word separator to '-' (#417) --- docs/zh-cn/user/configuration/config-center.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh-cn/user/configuration/config-center.md b/docs/zh-cn/user/configuration/config-center.md index ca5af6a..db5c419 100644 --- a/docs/zh-cn/user/configuration/config-center.md +++ b/docs/zh-cn/user/configuration/config-center.md @@ -40,7 +40,7 @@ configCenter.setAddress("zookeeper://127.0.0.1:2181"); dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.registry.simplified=true -dubbo.metadataReport.address=zookeeper://127.0.0.1:2181 +dubbo.metadata-report.address=zookeeper://127.0.0.1:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20880 @@ -54,7 +54,7 @@ dubbo.application.qos.port=3 外部化配置默认较本地配置有更高的优先级,因此这里配置的内容会覆盖本地配置值,关于[各配置形式间的覆盖关系](./configuration-load-process.md)有单独一章说明,你也可通过以下选项调整配置中心的优先级: ```properties - -Ddubbo.configCenter.highestPriority=false + -Ddubbo.config-center.highest-priority=false ``` - 作用域
[dubbo-website] branch asf-site updated: [Doc] Dubbo's Config Center model corresponding to different thirdparty products (#388)
This is an automated email from the ASF dual-hosted git repository. liujun 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 43cd04a [Doc] Dubbo's Config Center model corresponding to different thirdparty products (#388) 43cd04a is described below commit 43cd04ae017a3d7b3bb49c9841d5835bbe9c2144 Author: ken.lj AuthorDate: Thu Jun 27 16:20:44 2019 +0800 [Doc] Dubbo's Config Center model corresponding to different thirdparty products (#388) --- docs/zh-cn/dev/configcenter/design.md | 82 ++ img/configcenter_nacos_model.jpg | Bin 0 -> 78352 bytes img/configcenter_zk_model.jpg | Bin 0 -> 189160 bytes img/configcenter_zk_properties.jpg| Bin 0 -> 92946 bytes img/configcenter_zk_rule.jpg | Bin 0 -> 131167 bytes img/configcenter_zk_singleitem.jpg| Bin 0 -> 53837 bytes 6 files changed, 82 insertions(+) diff --git a/docs/zh-cn/dev/configcenter/design.md b/docs/zh-cn/dev/configcenter/design.md new file mode 100644 index 000..ae521a8 --- /dev/null +++ b/docs/zh-cn/dev/configcenter/design.md @@ -0,0 +1,82 @@ +# Dubbo配置中心 + +## 设计目的 +配置中心的核心功能是作为Key-Value存储,Dubbo框架告知配置中心其关心的key,配置中心返回该key对应的value值。 + +按照应用场景划分,配置中心在Dubbo框架中主要承担以下职责: + +- 作为外部化配置中心,即存储dubbo.properties配置文件,此时,key值通常为文件名如dubbo.properties,value则为配置文件内容。 +- 存储单个配置项,如各种开关项、常量值等。 +- 存储服务治理规则,此时key通常按照"服务名+规则类型"的格式来组织,而value则为具体的治理规则。 + +为了进一步实现对key-value的分组管理,Dubbo的配置中心还加入了namespace、group的概念,这些概念在很多专业的第三方配置中心中都有体现,通常情况下,namespace用来隔离不同的租户,group用来对统一租户的key集合做分组。 + +当前,Dubbo配置中心实现了对Zookeeper、Nacos、Etcd、Consul、Apollo的对接,接下来我们具体看一下Dubbo抽象的配置中心是怎么映射到具体的第三方实现中的。 + +## 实现原理 + +### Zookeeper + +zookeeper提供了一个树状的存储模型,其实现原理如下: + +![image-20190127225608553](/img/configcenter_zk_model.jpg) + +namespace, group, key等分别对应不同层级的ZNode节点,而value则作为根ZNode节点的值存储。 + +1. 外部化配置中心 dubbo.properties + + ![image-20190127225608553](/img/configcenter_zk_properties.jpg) + + 上图展示了两个不同作用域的dubbo.properties文件在zookeeper中的存储结构: + - 命名空间namespace都为:dubbo + - 分组group:全局级别为dubbo,所有应用共享;应用级别为应用名demo-provider,只对改应用生效 + - key:dubbo.properties + +2. 单个配置项 + + ![image-20190127225608553](/img/configcenter_zk_singleitem.jpg) + + 设置优雅停机事件为15000: + - 命名空间namespace:dubbo + - 分组group:dubbo + - key:dubbo.service.shutdown.wait=15000 + +3. 服务治理规则 + +![image-20190127225608553](/img/configcenter_zk_rule.jpg) + +上图展示了一条应用级别的条件路由规则: + +- 命名空间namespace:dubbo +- 分组group:dubbo +- key:governance-conditionrouter-consumer.condition-router,其中governance-conditionrouter-consumer为应用名,condition-router代表条件路由 + + +> 注意: +> +> Dubbo同时支持应用、服务两种粒度的服务治理规则,对于这两种粒度,其key取值规则如下: +> * 应用粒度 {应用名 + 规则后缀}。如: `demo-application.configurators`、`demo-application.tag-router`等 +> * 服务粒度 {服务接口名:[服务版本]:[服务分组] + 规则后缀},其中服务版本、服务分组是可选的,如果它们有配置则在key中体现,没被配置则用":"占位。如 +> `org.apache.dubbo.demo.DemoService::.configurators`、`org.apache.dubbo.demo.DemoService:1.0.0:group1.configurators` + +### Etcd & Consul + +Etcd和Consul本质上也是一种类似zookeeper的树状存储结构,实现请参考zookeeper。 + +### Nacos + +Nacos作为一个专业的第三方配置中心,拥有专门为配置中心设计的存储结构,包括内置的namespace、group、dataid等概念。并且这几个概念基本上与Dubbo框架抽象的配置中心是一一对应的。 + +与Zookeeper实现的对应关系如下: + +![image-20190127225608553](/img/configcenter_nacos_model.jpg) + +参考上文关于zookeeper实现中描述的示例,这里的dataid可能为: +* 外部化配置中心:dubbo.properties +* 单个配置项:dubbo.service.shutdown.wait +* 服务治理规则:org.apache.dubbo.demo.DemoService:1.0.0:group1.configurators + +### Apollo + +Apollo与Nacos类似,请参考动态配置中心使用文档中关于Apollo部分的描述。 + diff --git a/img/configcenter_nacos_model.jpg b/img/configcenter_nacos_model.jpg new file mode 100644 index 000..b6d1011 Binary files /dev/null and b/img/configcenter_nacos_model.jpg differ diff --git a/img/configcenter_zk_model.jpg b/img/configcenter_zk_model.jpg new file mode 100644 index 000..33a1b55 Binary files /dev/null and b/img/configcenter_zk_model.jpg differ diff --git a/img/configcenter_zk_properties.jpg b/img/configcenter_zk_properties.jpg new file mode 100644 index 000..0f95ca8 Binary files /dev/null and b/img/configcenter_zk_properties.jpg differ diff --git a/img/configcenter_zk_rule.jpg b/img/configcenter_zk_rule.jpg new file mode 100644 index 000..f39da96 Binary files /dev/null and b/img/configcenter_zk_rule.jpg differ diff --git a/img/configcenter_zk_singleitem.jpg b/img/configcenter_zk_singleitem.jpg new file mode 100644 index 000..641ffee Binary files /dev/null and b/img/configcenter_zk_singleitem.jpg differ
[dubbo-admin] branch develop updated: change jdk version
This is an automated email from the ASF dual-hosted git repository. min pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git The following commit(s) were added to refs/heads/develop by this push: new 3a2ffaf change jdk version 3a2ffaf is described below commit 3a2ffafa01a487b34499853618ef56ce5a168439 Author: nzomkxia AuthorDate: Thu Jun 27 16:13:02 2019 +0800 change jdk version --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ddf182d..76ad517 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: java sudo: false # faster builds jdk: -- oraclejdk8 -- oraclejdk11 +- openjdk8 +- openjdk11 cache: directories:
[dubbo] branch master updated (52bef81 -> 024651d)
This is an automated email from the ASF dual-hosted git repository. huxing pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/dubbo.git. from 52bef81 synchronized local variables or parameters should be set to final (#4325) add 024651d fix bug about nacos (#4308) No new revisions were added by this update. Summary of changes: .../java/org/apache/dubbo/registry/nacos/NacosRegistryFactory.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
[dubbo] branch master updated: synchronized local variables or parameters should be set to final (#4325)
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/dubbo.git The following commit(s) were added to refs/heads/master by this push: new 52bef81 synchronized local variables or parameters should be set to final (#4325) 52bef81 is described below commit 52bef8117b3b44dcb25df6f95914f94776a0cc73 Author: jimin AuthorDate: Thu Jun 27 15:01:45 2019 +0800 synchronized local variables or parameters should be set to final (#4325) * synchronized local variables or parameters should be set to final Signed-off-by: slievrly * remove unused import Signed-off-by: slievrly --- .../src/main/java/org/apache/dubbo/common/bytecode/Proxy.java | 2 +- .../main/java/org/apache/dubbo/common/extension/ExtensionLoader.java | 2 +- .../java/org/apache/dubbo/registry/multicast/MulticastRegistry.java | 4 ++-- .../src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Proxy.java b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Proxy.java index 2da2818..808a859 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Proxy.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Proxy.java @@ -102,7 +102,7 @@ public abstract class Proxy { String key = sb.toString(); // get cache by class loader. -Map cache; +final Map cache; synchronized (PROXY_CACHE_MAP) { cache = PROXY_CACHE_MAP.computeIfAbsent(cl, k -> new HashMap<>()); } 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 18b216d..4b5a44f 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 @@ -342,7 +342,7 @@ public class ExtensionLoader { if ("true".equals(name)) { return getDefaultExtension(); } -Holder holder = getOrCreateHolder(name); +final Holder holder = getOrCreateHolder(name); Object instance = holder.get(); if (instance == null) { synchronized (holder) { diff --git a/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java index 27aded1..0c28445 100644 --- a/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java +++ b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java @@ -263,7 +263,7 @@ public class MulticastRegistry extends FailbackRegistry { } @Override -public void doSubscribe(URL url, NotifyListener listener) { +public void doSubscribe(URL url, final NotifyListener listener) { if (ANY_VALUE.equals(url.getServiceInterface())) { admin = true; } @@ -324,7 +324,7 @@ public class MulticastRegistry extends FailbackRegistry { } urls.add(url); List list = toList(urls); -for (NotifyListener listener : entry.getValue()) { +for (final NotifyListener listener : entry.getValue()) { notify(key, listener, list); synchronized (listener) { listener.notify(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java index 19090c1..a248fa4 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java @@ -57,7 +57,7 @@ public class ActiveLimitFilter extends ListenableFilter { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, ACTIVES_KEY, 0); -RpcStatus rpcStatus = RpcStatus.getStatus(invoker.getUrl(), invocation.getMethodName()); +final RpcStatus rpcStatus = RpcStatus.getStatus(invoker.getUrl(), invocation.getMethodName()); if (!RpcStatus.beginCount(url, methodName, max)) { long timeout = invoker.getUrl().getMethodParameter(invocation.getMethodName(), TIMEOUT_KEY, 0); long start = System.currentTimeMillis(); @@ -109,7 +109,7 @@ public class ActiveLimitFilter extends ListenableFilter { return
[dubbo] branch master updated: allow @Service and @Reference to merge attributes form annotations in lower levels of the annotation hierachy. (#4078)
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/dubbo.git The following commit(s) were added to refs/heads/master by this push: new 1a9ddd8 allow @Service and @Reference to merge attributes form annotations in lower levels of the annotation hierachy. (#4078) 1a9ddd8 is described below commit 1a9ddd866658f6ccae056e14face4152551de17e Author: wenchao wang AuthorDate: Thu Jun 27 01:53:02 2019 -0500 allow @Service and @Reference to merge attributes form annotations in lower levels of the annotation hierachy. (#4078) * allow @Service and @Reference to merge attributes form annotations in lower levels of the annotation hierachy. * remove author information & not introduce all dependencies for test --- ...atibleReferenceAnnotationBeanPostProcessor.java | 8 +-- ...mpatibleServiceAnnotationBeanPostProcessor.java | 4 +- .../AnnotationInjectedBeanPostProcessor.java | 8 +-- .../ServiceAnnotationBeanPostProcessor.java| 4 +- .../spring/annotation/merged/MergedReference.java | 40 .../spring/annotation/merged/MergedService.java| 40 .../factory/annotation/MergedAnnotationTest.java | 74 ++ 7 files changed, 166 insertions(+), 12 deletions(-) diff --git a/dubbo-compatible/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/CompatibleReferenceAnnotationBeanPostProcessor.java b/dubbo-compatible/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/CompatibleReferenceAnnotationBeanPostProcessor.java index d6826a5..56844be 100644 --- a/dubbo-compatible/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/CompatibleReferenceAnnotationBeanPostProcessor.java +++ b/dubbo-compatible/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/CompatibleReferenceAnnotationBeanPostProcessor.java @@ -55,8 +55,8 @@ import java.util.concurrent.ConcurrentMap; import static org.springframework.core.BridgeMethodResolver.findBridgedMethod; import static org.springframework.core.BridgeMethodResolver.isVisibilityBridgeMethodPair; -import static org.springframework.core.annotation.AnnotationUtils.findAnnotation; -import static org.springframework.core.annotation.AnnotationUtils.getAnnotation; +import static org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation; +import static org.springframework.core.annotation.AnnotatedElementUtils.getMergedAnnotation; /** * {@link org.springframework.beans.factory.config.BeanPostProcessor} implementation @@ -116,7 +116,7 @@ public class CompatibleReferenceAnnotationBeanPostProcessor extends Instantiatio @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { -Reference reference = getAnnotation(field, Reference.class); +Reference reference = getMergedAnnotation(field, Reference.class); if (reference != null) { @@ -157,7 +157,7 @@ public class CompatibleReferenceAnnotationBeanPostProcessor extends Instantiatio return; } -Reference reference = findAnnotation(bridgedMethod, Reference.class); +Reference reference = findMergedAnnotation(bridgedMethod, Reference.class); if (reference != null && method.equals(ClassUtils.getMostSpecificMethod(method, beanClass))) { if (Modifier.isStatic(method.getModifiers())) { diff --git a/dubbo-compatible/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/CompatibleServiceAnnotationBeanPostProcessor.java b/dubbo-compatible/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/CompatibleServiceAnnotationBeanPostProcessor.java index 3d0370c..470352f 100644 --- a/dubbo-compatible/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/CompatibleServiceAnnotationBeanPostProcessor.java +++ b/dubbo-compatible/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/CompatibleServiceAnnotationBeanPostProcessor.java @@ -63,7 +63,7 @@ import java.util.Set; import static org.apache.dubbo.config.spring.util.ObjectUtils.of; import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition; import static org.springframework.context.annotation.AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR; -import static org.springframework.core.annotation.AnnotationUtils.findAnnotation; +import static org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation; import static org.springframework.util.ClassUtils.resolveClassName; /** @@ -251,7 +251,7 @@ public class CompatibleServiceAnnotationBeanPostProcessor implements BeanDefinit Class beanClass = resolveClass(beanDefinitionHolder); -
[dubbo-admin] branch develop updated: fix UT
This is an automated email from the ASF dual-hosted git repository. min pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git The following commit(s) were added to refs/heads/develop by this push: new cf490b5 fix UT cf490b5 is described below commit cf490b53233d178a52d8cfd807a23dfd36bbef6b Author: nzomkxia AuthorDate: Thu Jun 27 14:33:18 2019 +0800 fix UT --- .../test/java/org/apache/dubbo/admin/config/ConfigCenterTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dubbo-admin-server/src/test/java/org/apache/dubbo/admin/config/ConfigCenterTest.java b/dubbo-admin-server/src/test/java/org/apache/dubbo/admin/config/ConfigCenterTest.java index 4ce1be8..2def1ac 100644 --- a/dubbo-admin-server/src/test/java/org/apache/dubbo/admin/config/ConfigCenterTest.java +++ b/dubbo-admin-server/src/test/java/org/apache/dubbo/admin/config/ConfigCenterTest.java @@ -69,7 +69,7 @@ public class ConfigCenterTest { public void testGetDynamicConfiguration() throws Exception { // mock @value inject ReflectionTestUtils.setField(configCenter, "configCenter", zkAddress); -ReflectionTestUtils.setField(configCenter, "group", "dubbo"); +ReflectionTestUtils.setField(configCenter, "configCenterGroup", "dubbo"); ReflectionTestUtils.setField(configCenter, "username", "username"); ReflectionTestUtils.setField(configCenter, "password", "password"); @@ -129,7 +129,7 @@ public class ConfigCenterTest { // mock @value inject ReflectionTestUtils.setField(configCenter, "registryAddress", zkAddress); -ReflectionTestUtils.setField(configCenter, "group", "dubbo"); +ReflectionTestUtils.setField(configCenter, "registryGroup", "dubbo"); ReflectionTestUtils.setField(configCenter, "username", "username"); ReflectionTestUtils.setField(configCenter, "password", "password"); @@ -148,7 +148,7 @@ public class ConfigCenterTest { // mock @value inject ReflectionTestUtils.setField(configCenter, "metadataAddress", zkAddress); -ReflectionTestUtils.setField(configCenter, "group", "dubbo"); +ReflectionTestUtils.setField(configCenter, "metadataGroup", "dubbo"); ReflectionTestUtils.setField(configCenter, "username", "username"); ReflectionTestUtils.setField(configCenter, "password", "password");