diff --git a/README.md b/README.md index fdc3062d6f086be14ad19b1f718f713c54fb48ed..694f0091533f644b58438c6487dc53348add6e60 100644 --- a/README.md +++ b/README.md @@ -98,11 +98,11 @@ You can know more about dubbo-go by its [roadmap](https://github.com/apache/dubb ## Document -TODO +https://dubbogo.github.io/dubbo-go-website(**Improving**) ## Quick Start -[dubbogo-samples](https://github.com/dubbogo/dubbogo-samples) shows how to use dubbo-go. Please read the [dubbogo-samples/README.md](https://github.com/dubbogo/dubbogo-samples/blob/master/README.md) carefully to learn how to dispose the configuration and compile the program. +[dubbo-samples/golang](https://github.com/dubbogo/dubbo-samples) shows how to use dubbo-go. Please read the [dubbo-samples/golang/README.md](https://github.com/dubbogo/dubbo-samples/blob/master/golang/README.md) carefully to learn how to dispose the configuration and compile the program. ## Running unit tests diff --git a/README_CN.md b/README_CN.md index edabe64d376cd4d49f6ab4251db9387aca48bbf0..99b26c5357ddb0482faf5a95b5935b0d9603c40b 100644 --- a/README_CN.md +++ b/README_CN.md @@ -97,11 +97,11 @@ Apache License, Version 2.0 ## 鏂囨。 -TODO +https://dubbogo.github.io/dubbo-go-website(**瀹屽杽涓�**) ## 蹇€熷紑濮� ## -[dubbogo-samples](https://github.com/dubbogo/dubbogo-samples)杩欎釜椤圭洰鐨勪簨渚嬪睍绀轰簡濡備綍浣跨敤 dubbo-go 銆傝浠旂粏闃呰 [dubbogo-samples/README.md](https://github.com/dubbogo/dubbogo-samples/blob/master/README.md) 瀛︿範濡備綍澶勭悊閰嶇疆骞剁紪璇戠▼搴忋€� +[dubbo-samples/golang](https://github.com/dubbogo/dubbo-samples)杩欎釜椤圭洰鐨勪簨渚嬪睍绀轰簡濡備綍浣跨敤 dubbo-go 銆傝浠旂粏闃呰 [dubbo-samples/golang/README.md](https://github.com/dubbogo/dubbo-samples/blob/master/golang/README.md) 瀛︿範濡備綍澶勭悊閰嶇疆骞剁紪璇戠▼搴忋€� ## 杩愯鍗曟祴 diff --git a/filter/filter/generic_filter.go b/filter/filter/generic_filter.go index f15449520d4a3d69a89cec2ce195114934e14211..9fb26f15aec7027d46526ed61a46d088a0b6b5e8 100644 --- a/filter/filter/generic_filter.go +++ b/filter/filter/generic_filter.go @@ -47,22 +47,21 @@ type GenericFilter struct{} func (ef *GenericFilter) Invoke(invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result { if invocation.MethodName() == constant.GENERIC && len(invocation.Arguments()) == 3 { oldArguments := invocation.Arguments() - var newParams []hessian.Object + if oldParams, ok := oldArguments[2].([]interface{}); ok { + newParams := make([]hessian.Object, 0, len(oldParams)) for i := range oldParams { newParams = append(newParams, hessian.Object(struct2MapAll(oldParams[i]))) } - } else { - return invoker.Invoke(invocation) - } - newArguments := []interface{}{ - oldArguments[0], - oldArguments[1], - newParams, + newArguments := []interface{}{ + oldArguments[0], + oldArguments[1], + newParams, + } + newInvocation := invocation2.NewRPCInvocation(invocation.MethodName(), newArguments, invocation.Attachments()) + newInvocation.SetReply(invocation.Reply()) + return invoker.Invoke(newInvocation) } - newInvocation := invocation2.NewRPCInvocation(invocation.MethodName(), newArguments, invocation.Attachments()) - newInvocation.SetReply(invocation.Reply()) - return invoker.Invoke(newInvocation) } return invoker.Invoke(invocation) } diff --git a/protocol/invocation/rpcinvocation.go b/protocol/invocation/rpcinvocation.go index 2124a22f1611b24d7f4370de64b117c58c4f7e7b..bddd83b5db60cc3ccaa1ab0c43aaeec28e77855d 100644 --- a/protocol/invocation/rpcinvocation.go +++ b/protocol/invocation/rpcinvocation.go @@ -19,6 +19,7 @@ package invocation import ( "reflect" + "sync" ) import ( @@ -37,6 +38,7 @@ type RPCInvocation struct { callBack interface{} attachments map[string]string invoker protocol.Invoker + lock sync.RWMutex } func NewRPCInvocation(methodName string, arguments []interface{}, attachments map[string]string) *RPCInvocation { @@ -80,6 +82,8 @@ func (r *RPCInvocation) Attachments() map[string]string { } func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string { + r.lock.RLock() + defer r.lock.RUnlock() if r.attachments == nil { return defaultValue } @@ -91,6 +95,8 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string } func (r *RPCInvocation) SetAttachments(key string, value string) { + r.lock.Lock() + defer r.lock.Unlock() if r.attachments == nil { r.attachments = make(map[string]string) }