From 2468348ccb7df0ee4eebc636c0f336b7ee06645b Mon Sep 17 00:00:00 2001 From: fangyincheng <fangyincheng@sina.com> Date: Tue, 18 Jun 2019 10:13:14 +0800 Subject: [PATCH] Mod:format --- common/proxy/invoker.go | 40 --------------------------- common/proxy/proxy_factory/default.go | 3 +- protocol/dubbo/listener.go | 2 +- protocol/jsonrpc/jsonrpc_protocol.go | 7 +++-- registry/directory/directory.go | 2 +- 5 files changed, 9 insertions(+), 45 deletions(-) delete mode 100644 common/proxy/invoker.go diff --git a/common/proxy/invoker.go b/common/proxy/invoker.go deleted file mode 100644 index 1a703d112..000000000 --- a/common/proxy/invoker.go +++ /dev/null @@ -1,40 +0,0 @@ -package proxy - -import ( - "github.com/apache/dubbo-go/common" - "github.com/apache/dubbo-go/protocol" -) - -type CallInvoker struct { - protocol.BaseInvoker -} - -func NewCallInvoker(url common.URL) *CallInvoker { - return &CallInvoker{ - BaseInvoker: *protocol.NewBaseInvoker(url), - } -} - -func (bi *CallInvoker) Invoke(invocation protocol.Invocation) protocol.Result { - rpcResult := &protocol.RPCResult{Attrs: invocation.Attachments()} - //todo:call service - - // get method - //proto := bi.GetUrl().Protocol - //if bi.GetUrl().SubURL != nil { - // proto = bi.GetUrl().SubURL.Protocol - //} - //svc := common.ServiceMap.GetService(proto, serviceName) - //if svc == nil { - // return perrors.New("cannot find svc " + serviceName) - //} - //method := svc.Method()[methodName] - //if method == nil { - // logger.Errorf("method not found!") - // rpcResult.Err = perrors.New("cannot find method " + methodName + " of svc " + serviceName) - // return rpcResult - //} - // - //returnValues := method.Method().Func.Call(in) - return rpcResult -} diff --git a/common/proxy/proxy_factory/default.go b/common/proxy/proxy_factory/default.go index 62940fc81..1665a7346 100644 --- a/common/proxy/proxy_factory/default.go +++ b/common/proxy/proxy_factory/default.go @@ -51,5 +51,6 @@ func (factory *DefaultProxyFactory) GetProxy(invoker protocol.Invoker, url *comm return proxy.NewProxy(invoker, nil, attachments) } func (factory *DefaultProxyFactory) GetInvoker(url common.URL) protocol.Invoker { - return proxy.NewCallInvoker(url) + // todo: call service + return protocol.NewBaseInvoker(url) } diff --git a/protocol/dubbo/listener.go b/protocol/dubbo/listener.go index 4975bc370..b77918383 100644 --- a/protocol/dubbo/listener.go +++ b/protocol/dubbo/listener.go @@ -20,7 +20,6 @@ package dubbo import ( "context" "fmt" - "github.com/apache/dubbo-go/protocol" "net/url" "reflect" "sync" @@ -37,6 +36,7 @@ import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol/invocation" ) diff --git a/protocol/jsonrpc/jsonrpc_protocol.go b/protocol/jsonrpc/jsonrpc_protocol.go index 7c05da7c8..c18345d41 100644 --- a/protocol/jsonrpc/jsonrpc_protocol.go +++ b/protocol/jsonrpc/jsonrpc_protocol.go @@ -17,14 +17,17 @@ package jsonrpc +import ( + "strings" + "sync" +) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/config" "github.com/apache/dubbo-go/protocol" - "strings" - "sync" ) const JSONRPC = "jsonrpc" diff --git a/registry/directory/directory.go b/registry/directory/directory.go index 8352536ee..a4a926315 100644 --- a/registry/directory/directory.go +++ b/registry/directory/directory.go @@ -18,7 +18,6 @@ package directory import ( - "github.com/apache/dubbo-go/remoting" "sync" "time" ) @@ -36,6 +35,7 @@ import ( "github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol/protocolwrapper" "github.com/apache/dubbo-go/registry" + "github.com/apache/dubbo-go/remoting" ) const ( -- GitLab