Skip to content

Commit

Permalink
Merge pull request #760 from georgehao/refact-seri
Browse files Browse the repository at this point in the history
feat: delete dubbo_protocol assert remoting.ExchangeClient
  • Loading branch information
AlexStocks authored Sep 17, 2020
2 parents 1e033d2 + 2d5b004 commit cb290c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
16 changes: 3 additions & 13 deletions protocol/dubbo/dubbo_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -215,17 +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
}
return exchangeClient
return clientTmp.(*remoting.ExchangeClient)
}

// rebuildCtx rebuild the context by attachment.
Expand Down
1 change: 0 additions & 1 deletion protocol/jsonrpc/jsonrpc_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
8 changes: 4 additions & 4 deletions remoting/getty/getty_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ 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),
gxsync.WithTaskPoolTaskQueueNumber(srvConf.QueueNumber))
}
}

// Server ...
// Server define getty server
type Server struct {
conf ServerConfig
addr string
Expand All @@ -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)
Expand Down Expand Up @@ -210,7 +210,7 @@ func (s *Server) Start() {

}

// Stop ...
// Stop dubbo server
func (s *Server) Stop() {
s.tcpServer.Close()
}

0 comments on commit cb290c9

Please sign in to comment.