diff --git a/cluster/directory/base_directory.go b/cluster/directory/base_directory.go index 98b392221a48edc9b873c571dcbf5383e2d790c8..ac7b04fa3386a8c2d8b7a7fac2ca3ae73c21305d 100644 --- a/cluster/directory/base_directory.go +++ b/cluster/directory/base_directory.go @@ -19,8 +19,6 @@ package directory import ( "sync" - - "github.com/apache/dubbo-go/cluster/router/router_chain" ) import ( "go.uber.org/atomic" @@ -36,12 +34,11 @@ import ( var RouterUrlSet = gxset.NewSet() type BaseDirectory struct { - url *common.URL - destroyed *atomic.Bool - routers []cluster.Router - mutex sync.Mutex - once sync.Once - routerChain *router_chain.RouterChain + url *common.URL + destroyed *atomic.Bool + routers []cluster.Router + mutex sync.Mutex + once sync.Once } func NewBaseDirectory(url *common.URL) BaseDirectory { diff --git a/cluster/router/router_chain/router_chain.go b/cluster/router/router_chain/router_chain.go deleted file mode 100644 index dab644db69acc229f112221bceb91171c85485e4..0000000000000000000000000000000000000000 --- a/cluster/router/router_chain/router_chain.go +++ /dev/null @@ -1,49 +0,0 @@ -package router_chain - -import ( - "sort" -) -import ( - "github.com/apache/dubbo-go/cluster" - "github.com/apache/dubbo-go/common" - "github.com/apache/dubbo-go/common/extension" - "github.com/apache/dubbo-go/protocol" -) - -type RouterChain struct { - routers []cluster.Router - builtinRouters []cluster.Router - Invokers []protocol.Invoker -} - -func NewRouterChain(url *common.URL) *RouterChain { - var builtinRouters []cluster.Router - factories := extension.GetRouterFactories() - for _, factory := range factories { - router, _ := factory.Router(url) - builtinRouters = append(builtinRouters, router) - } - var routers []cluster.Router - copy(routers, builtinRouters) - sort.SliceStable(routers, func(i, j int) bool { - return routers[i].Priority() < routers[j].Priority() - }) - return &RouterChain{ - builtinRouters: builtinRouters, - routers: routers, - } -} - -func (r RouterChain) AddRouters(routers []cluster.Router) { - r.routers = append(r.routers, routers...) - sort.SliceStable(r.routers, func(i, j int) bool { - return routers[i].Priority() < routers[j].Priority() - }) -} - -func (r RouterChain) SetInvokers(invokers []protocol.Invoker) { - r.Invokers = invokers - /*for _, _ := range r.routers { - //router.Notify(r.Invokers) - }*/ -} diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go index 5246bfc15be1237576555539d9a13b9e848e3497..534a4b945965f332e49ff343557fa20355921454 100644 --- a/registry/protocol/protocol.go +++ b/registry/protocol/protocol.go @@ -20,13 +20,10 @@ package protocol import ( "strings" "sync" - - "github.com/apache/dubbo-go/cluster" - "github.com/apache/dubbo-go/cluster/router/router_chain" ) import ( - gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/container/gxset" ) import ( @@ -124,10 +121,6 @@ func (proto *registryProtocol) Refer(url common.URL) protocol.Invoker { } go directory.Subscribe(serviceUrl) - chain := router_chain.NewRouterChain(serviceUrl) - if chain != nil { - //directory.SetRouters(chain.) - } //new cluster invoker cluster := extension.GetCluster(serviceUrl.GetParam(constant.CLUSTER_KEY, constant.DEFAULT_CLUSTER))