[dubbo] branch master updated: simplify code for Wrapper.java and others (#6684)

2020-09-04 Thread hyunkun
This is an automated email from the ASF dual-hosted git repository.

hyunkun 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 ae514c0  simplify code for Wrapper.java and others (#6684)
ae514c0 is described below

commit ae514c0f8a726268b9a42fe1903e1f59d6d24c3f
Author: 石头 <1027926...@qq.com>
AuthorDate: Fri Sep 4 15:28:05 2020 +0800

simplify code for Wrapper.java and others (#6684)
---
 .../src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java   | 2 +-
 .../src/main/java/org/apache/dubbo/config/context/ConfigManager.java  | 4 +---
 .../java/org/apache/dubbo/registry/multicast/MulticastRegistry.java   | 4 +---
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java 
b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java
index 509ae98..345b79e 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java
@@ -113,7 +113,7 @@ public abstract class Wrapper {
 return OBJECT_WRAPPER;
 }
 
-return WRAPPER_MAP.computeIfAbsent(c, key -> makeWrapper(key));
+return WRAPPER_MAP.computeIfAbsent(c, Wrapper::makeWrapper);
 }
 
 private static Wrapper makeWrapper(Class c) {
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java 
b/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
index 218fef0..e6c5fef 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
@@ -374,9 +374,7 @@ public class ConfigManager extends LifecycleAdapter 
implements FrameworkExt {
 }
 
 public void clear() {
-write(() -> {
-this.configsCache.clear();
-});
+write(this.configsCache::clear);
 }
 
 /**
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 3a6462d..7807fec 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
@@ -361,9 +361,7 @@ public class MulticastRegistry extends FailbackRegistry {
 private List toList(Set urls) {
 List list = new ArrayList();
 if (CollectionUtils.isNotEmpty(urls)) {
-for (URL url : urls) {
-list.add(url);
-}
+list.addAll(urls);
 }
 return list;
 }



[dubbo-go-hessian2] branch fix/1.6.3-zhantu created (now f739223)

2020-09-04 Thread alexstocks
This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a change to branch fix/1.6.3-zhantu
in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git.


  at f739223  revert zhantu interface{} attachment

This branch includes the following new commits:

 new f739223  revert zhantu interface{} attachment

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.




[dubbo-go-hessian2] 01/01: revert zhantu interface{} attachment

2020-09-04 Thread alexstocks
This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch fix/1.6.3-zhantu
in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git

commit f73922387446d1230c781eb05b48db28085d85d3
Author: AlexStocks 
AuthorDate: Sat Sep 5 00:05:39 2020 +0800

revert zhantu interface{} attachment
---
 contributing.md  | 40 +++-
 hessian.go   |  6 ++
 hessian_test.go  | 16 +---
 request.go   | 18 +-
 request_test.go  |  8 
 response.go  | 22 ++
 response_test.go |  5 +
 7 files changed, 66 insertions(+), 49 deletions(-)

diff --git a/contributing.md b/contributing.md
index 15c9610..5130151 100644
--- a/contributing.md
+++ b/contributing.md
@@ -1,4 +1,4 @@
-Contributing to Hessian2 Protocol Go Implementation
+Contributing to Dubbogo
 
 ## 1. Branch
 
@@ -24,3 +24,41 @@ 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. Code Style
+
+### 3.1 log
+
+>- 1 when logging the function's input parameter, you should add '@' before 
input parameter name.
+
+### 3.2 naming
+
+>- 1 do not use an underscore in package name, such as `filter_impl`.
+>- 2 do not use an underscore in constants, such as `DUBBO_PROTOCOL`. use 
'DubboProtocol' instead.
+
+### 3.3 comment
+
+>- 1 there should be comment for every export func/var.
+>- 2 the comment should begin with function name/var name.
+
+### 3.4 import 
+
+We dubbogo import blocks should be splited into 3 blocks.
+
+```Go
+// block 1: the go internal package
+import (
+  "fmt"
+)
+
+// block 2: the third package
+import (
+  "github.com/dubbogo/xxx"
+  
+  "github.com/RoaringBitmap/roaring"
+)
+
+// block 3: the dubbo-go package
+import (
+  "github.com/apache/dubbo-go/common"
+) 
+```
\ No newline at end of file
diff --git a/hessian.go b/hessian.go
index 6527604..c80345c 100644
--- a/hessian.go
+++ b/hessian.go
@@ -21,9 +21,7 @@ import (
"bufio"
"encoding/binary"
"time"
-)
 
-import (
perrors "github.com/pkg/errors"
 )
 
@@ -218,7 +216,7 @@ func (h *HessianCodec) ReadBody(rspObj interface{}) error {
 }
 
 // ignore body, but only read attachments
-func (h *HessianCodec) ReadAttachments() (map[string]interface{}, error) {
+func (h *HessianCodec) ReadAttachments() (map[string]string, error) {
if h.reader.Buffered() < h.bodyLen {
return nil, ErrBodyNotEnough
}
@@ -237,7 +235,7 @@ func (h *HessianCodec) ReadAttachments() 
(map[string]interface{}, error) {
if err = unpackRequestBody(NewDecoderWithSkip(buf[:]), rspObj); 
err != nil {
return nil, perrors.WithStack(err)
}
-   return rspObj[6].(map[string]interface{}), nil
+   return rspObj[6].(map[string]string), nil
case PackageResponse:
rspObj := &Response{}
if err = unpackResponseBody(NewDecoderWithSkip(buf[:]), 
rspObj); err != nil {
diff --git a/hessian_test.go b/hessian_test.go
index 6f89f0b..653bdfb 100644
--- a/hessian_test.go
+++ b/hessian_test.go
@@ -23,9 +23,7 @@ import (
"reflect"
"testing"
"time"
-)
 
-import (
"github.com/stretchr/testify/assert"
 )
 
@@ -192,11 +190,10 @@ func TestRequest(t *testing.T) {
 }
 
 func TestHessianCodec_ReadAttachments(t *testing.T) {
-   RegisterPOJO(&AttachObject{})
body := &Response{
RspObj:  &CaseB{A: "A", B: CaseA{A: "a", B: 1, C: Case{A: 
"c", B: 2}}},
Exception:   nil,
-   Attachments: map[string]interface{}{DUBBO_VERSION_KEY: "2.6.4", 
"att": AttachObject{Id: 23, Name: "haha"}},
+   Attachments: map[string]string{DUBBO_VERSION_KEY: "2.6.4"},
}
resp, err := doTestHessianEncodeHeader(t, PackageResponse, Response_OK, 
body)
assert.NoError(t, err)
@@ -214,17 +211,6 @@ func TestHessianCodec_ReadAttachments(t *testing.T) {
attrs, err := codecR2.ReadAttachments()
assert.NoError(t, err)
assert.Equal(t, "2.6.4", attrs[DUBBO_VERSION_KEY])
-   assert.Equal(t, AttachObject{Id: 23, Name: "haha"}, 
*(attrs["att"].(*AttachObject)))
-   assert.NotEqual(t, AttachObject{Id: 24, Name: "nohaha"}, 
*(attrs["att"].(*AttachObject)))
 
t.Log(attrs)
 }
-
-type AttachObject struct {
-   Id   int32
-   Name string `dubbo:name`
-}
-
-func (AttachObject) JavaClassName() string {
-   return "com.test.Test"
-}
diff --git a/request.go b/request.go
index c668fcb..bad438b 100644
--- a/request.go
+++ b/request.go
@@ -23,9 +23,7 @@ import (
"strconv"
"strings"
"time"
-)
 
-import (
perrors "github.com/pkg/errors"
 )
 
@@ -151,13 +149,13 @@ func getArgsTypeList(args []interface{}) (string, error) {
 
 type Request s

[dubbo-go-hessian2] branch fix/1.6.3-zhantu updated (f739223 -> 09a0449)

2020-09-04 Thread alexstocks
This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a change to branch fix/1.6.3-zhantu
in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git.


from f739223  revert zhantu interface{} attachment
 add 09a0449  fix words error in contributing.go

No new revisions were added by this update.

Summary of changes:
 contributing.md | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)



[dubbo-go-hessian2] branch fix/1.6.3-zhantu updated (09a0449 -> b782fa6)

2020-09-04 Thread alexstocks
This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a change to branch fix/1.6.3-zhantu
in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git.


from 09a0449  fix words error in contributing.go
 add b782fa6  Format: import

No new revisions were added by this update.

Summary of changes:
 hessian.go  | 2 ++
 hessian_test.go | 2 ++
 request.go  | 2 ++
 3 files changed, 6 insertions(+)



[dubbo-go-hessian2] branch master updated (ef54e11 -> 2a6f325)

2020-09-04 Thread alexstocks
This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git.


from ef54e11  Merge pull request #221 from cyb-code/master
 add f739223  revert zhantu interface{} attachment
 add 09a0449  fix words error in contributing.go
 add b782fa6  Format: import
 new 2a6f325  Merge pull request #224 from apache/fix/1.6.3-zhantu

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:
 contributing.md  | 40 +++-
 hessian.go   |  4 ++--
 hessian_test.go  | 14 +-
 request.go   | 16 +---
 request_test.go  |  8 
 response.go  | 22 ++
 response_test.go |  5 +
 7 files changed, 66 insertions(+), 43 deletions(-)



[dubbo-go-hessian2] 01/01: Merge pull request #224 from apache/fix/1.6.3-zhantu

2020-09-04 Thread alexstocks
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

commit 2a6f325822f46137b8af0d7f3f2b4f9a3519f39c
Merge: ef54e11 b782fa6
Author: Xin.Zh 
AuthorDate: Sat Sep 5 11:00:46 2020 +0800

Merge pull request #224 from apache/fix/1.6.3-zhantu

Fix: revert zhantu interface{} attachment

 contributing.md  | 40 +++-
 hessian.go   |  4 ++--
 hessian_test.go  | 14 +-
 request.go   | 16 +---
 request_test.go  |  8 
 response.go  | 22 ++
 response_test.go |  5 +
 7 files changed, 66 insertions(+), 43 deletions(-)



[dubbo-go] branch develop updated (4c483e0 -> 6388c4a)

2020-09-04 Thread alexstocks
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 4c483e0  Merge pull request #730 from 
YongHaoWu/remove-unnecessary-statement
 new cadae7b  format
 new 941e69d  format
 new 1708b41  fix bug
 new 60f9822  format
 new 96d0f79  format
 new 09fa354  format
 new f8434c3  format
 new 6707cdc  Merge branch 'develop' into read
 new c1e9b84  format
 new 763b436  fix bug
 new 6388c4a  Merge pull request #722 from dubbo-x/read

The 2800 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:
 common/rpc_service.go  |  2 +-
 config/config_loader.go| 10 ++---
 config/consumer_config.go  |  4 +-
 config/provider_config.go  |  6 +--
 config/service_config.go   | 47 ++
 metadata/service/exporter/configurable/exporter.go |  1 -
 protocol/jsonrpc/jsonrpc_protocol.go   |  2 +-
 protocol/jsonrpc/server.go |  8 ++--
 .../protocolwrapper/protocol_filter_wrapper.go | 14 +++
 registry/protocol/protocol.go  | 17 
 registry/registry.go   | 34 ++--
 11 files changed, 70 insertions(+), 75 deletions(-)



[dubbo-go] branch refact-seri updated (d2bdc6f -> 566a7e3)

2020-09-04 Thread fangyc
This is an automated email from the ASF dual-hosted git repository.

fangyc pushed a change to branch refact-seri
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git.


from d2bdc6f  Mrg:merge develop
 add cadae7b  format
 add 941e69d  format
 add 1708b41  fix bug
 add 60f9822  format
 add 96d0f79  format
 add 09fa354  format
 add f8434c3  format
 add 7e4e7fd  chore: Remove unnecessary return and judgement.
 add 4c483e0  Merge pull request #730 from 
YongHaoWu/remove-unnecessary-statement
 add 6707cdc  Merge branch 'develop' into read
 add c1e9b84  format
 add 763b436  fix bug
 add 6388c4a  Merge pull request #722 from dubbo-x/read
 add 566a7e3  Mrg: merge from develop

No new revisions were added by this update.

Summary of changes:
 cluster/router/tag/tag_router.go   |  1 -
 common/rpc_service.go  |  4 +-
 common/url.go  |  2 +-
 config/base_config.go  | 16 ++--
 config/config_loader.go| 10 ++---
 config/consumer_config.go  |  4 +-
 config/provider_config.go  |  6 +--
 config/reference_config.go |  1 -
 config/service_config.go   | 47 ++
 config_center/configurator/override.go |  2 +-
 metadata/service/exporter/configurable/exporter.go |  1 -
 protocol/jsonrpc/jsonrpc_protocol.go   |  2 +-
 protocol/jsonrpc/server.go |  8 ++--
 .../protocolwrapper/protocol_filter_wrapper.go | 17 +++-
 protocol/rest/rest_exporter.go |  1 -
 registry/etcdv3/listener_test.go   |  1 -
 registry/event/service_revision_customizer.go  |  2 +-
 registry/protocol/protocol.go  | 19 -
 registry/registry.go   | 34 ++--
 .../curator_discovery/service_discovery.go |  1 -
 20 files changed, 78 insertions(+), 101 deletions(-)