diff --git a/protocol/dubbo/dubbo_protocol.go b/protocol/dubbo/dubbo_protocol.go index 2826e64d92004dc5ccb665ad923f16ca04fd859b..b8e9b59eb73f4f955be2da20d850b46277cb947d 100644 --- a/protocol/dubbo/dubbo_protocol.go +++ b/protocol/dubbo/dubbo_protocol.go @@ -48,8 +48,8 @@ const ( var ( // Make the connection can be shared. // It will create one connection for one address (ip+port) - exchangeClientMap *sync.Map = new(sync.Map) - exchangeLock *sync.Map = new(sync.Map) + exchangeClientMap = new(sync.Map) + exchangeLock = new(sync.Map) ) func init() { @@ -215,16 +215,7 @@ func getExchangeClient(url common.URL) *remoting.ExchangeClient { if clientTmp == nil { return nil } - exchangeClient, ok := clientTmp.(*remoting.ExchangeClient) - if !ok { - exchangeClientTmp := remoting.NewExchangeClient(url, getty.NewClient(getty.Options{ - ConnectTimeout: config.GetConsumerConfig().ConnectTimeout, - RequestTimeout: config.GetConsumerConfig().RequestTimeout}), config.GetConsumerConfig().ConnectTimeout, false) - if exchangeClientTmp != nil { - exchangeClientMap.Store(url.Location, exchangeClientTmp) - } - return exchangeClientTmp - } + exchangeClient := clientTmp.(*remoting.ExchangeClient) return exchangeClient } diff --git a/protocol/jsonrpc/jsonrpc_invoker.go b/protocol/jsonrpc/jsonrpc_invoker.go index 970d5f9a0814f20b4b67d20743b46cbd70526414..d84b980216ade6e569e68af31fc90e1ea16b3056 100644 --- a/protocol/jsonrpc/jsonrpc_invoker.go +++ b/protocol/jsonrpc/jsonrpc_invoker.go @@ -26,7 +26,6 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/protocol" - invocation_impl "github.com/apache/dubbo-go/protocol/invocation" ) diff --git a/remoting/getty/getty_server.go b/remoting/getty/getty_server.go index 98ca690cbf253d57d9101c54d715c3b1c9885bc0..be2dfd6bed54c321fd653bb800bd81c2d294d6b5 100644 --- a/remoting/getty/getty_server.go +++ b/remoting/getty/getty_server.go @@ -95,7 +95,7 @@ func GetServerConfig() ServerConfig { return *srvConf } -// SetServerGrpool ... +// SetServerGrpool set getty server GrPool func SetServerGrpool() { if srvConf.GrPoolSize > 1 { srvGrpool = gxsync.NewTaskPool(gxsync.WithTaskPoolTaskPoolSize(srvConf.GrPoolSize), gxsync.WithTaskPoolTaskQueueLength(srvConf.QueueLen), @@ -103,7 +103,7 @@ func SetServerGrpool() { } } -// Server ... +// Server define getty server type Server struct { conf ServerConfig addr string @@ -113,7 +113,7 @@ type Server struct { requestHandler func(*invocation.RPCInvocation) protocol.RPCResult } -// NewServer ... +// NewServer create a new Server func NewServer(url common.URL, handlers func(*invocation.RPCInvocation) protocol.RPCResult) *Server { //init initServer(url.Protocol) @@ -210,7 +210,7 @@ func (s *Server) Start() { } -// Stop ... +// Stop dubbo server func (s *Server) Stop() { s.tcpServer.Close() }