Skip to content
Snippets Groups Projects
Commit 517f54d5 authored by haohongfan's avatar haohongfan
Browse files

feat: delete dubbo_protocol assert remoting.ExchangeClient

parent 2f48d101
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
......
......@@ -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"
)
......
......@@ -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()
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment