Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
dea76beb
Commit
dea76beb
authored
5 years ago
by
aliiohs
Browse files
Options
Downloads
Patches
Plain Diff
fix cycle import bug
parent
50e42d0a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cluster/directory/base_directory.go
+10
-6
10 additions, 6 deletions
cluster/directory/base_directory.go
config/condition_router_config.go
+3
-1
3 additions, 1 deletion
config/condition_router_config.go
with
13 additions
and
7 deletions
cluster/directory/base_directory.go
+
10
−
6
View file @
dea76beb
...
...
@@ -21,7 +21,7 @@ import (
"github.com/apache/dubbo-go/cluster"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension"
"github.com/
apache/
dubbo
-
go/
config
"
"github.com/dubbogo/
gost/container
"
"go.uber.org/atomic"
"sync"
)
...
...
@@ -29,13 +29,14 @@ import (
"github.com/apache/dubbo-go/common"
)
var
RouterUrlSet
=
container
.
NewSet
()
type
BaseDirectory
struct
{
url
*
common
.
URL
ConsumerUrl
*
common
.
URL
destroyed
*
atomic
.
Bool
routers
[]
cluster
.
Router
mutex
sync
.
Mutex
once
sync
.
Once
}
func
NewBaseDirectory
(
url
*
common
.
URL
)
BaseDirectory
{
...
...
@@ -67,15 +68,18 @@ func (dir *BaseDirectory) SetRouters(routers []cluster.Router) {
dir
.
routers
=
routers
}
func
(
dir
*
BaseDirectory
)
Routers
()
[]
cluster
.
Router
{
dir
.
once
.
Do
(
func
()
{
var
routers
[]
cluster
.
Router
rs
:=
RouterUrlSet
.
Values
()
for
_
,
r
:=
range
rs
{
factory
:=
extension
.
GetRouterFactory
(
dir
.
GetUrl
()
.
Protocol
)
router
,
err
:=
factory
.
Router
(
config
.
GetRouterUrl
(
))
router
,
err
:=
factory
.
Router
(
r
.
(
*
common
.
URL
))
if
err
==
nil
{
dir
.
routers
=
append
(
dir
.
routers
,
router
)
}
})
return
dir
.
routers
routers
=
append
(
routers
,
router
)
}
return
append
(
dir
.
routers
,
routers
...
)
}
func
(
dir
*
BaseDirectory
)
Destroy
(
doDestroy
func
())
{
...
...
This diff is collapsed.
Click to expand it.
config/condition_router_config.go
+
3
−
1
View file @
dea76beb
...
...
@@ -18,6 +18,7 @@ package config
import
(
"encoding/base64"
"github.com/apache/dubbo-go/cluster/directory"
"io/ioutil"
"os"
"path"
...
...
@@ -79,10 +80,11 @@ func RouterInit(confRouterFile string) error {
}
logger
.
Debugf
(
"provider config{%#v}
\n
"
,
providerConfig
)
directory
.
RouterUrlSet
.
Add
(
initRouterUrl
())
return
nil
}
func
Ge
tRouterUrl
()
*
common
.
URL
{
func
ini
tRouterUrl
()
*
common
.
URL
{
mutex
.
Lock
()
if
routerConfig
==
nil
{
confRouterFile
:=
os
.
Getenv
(
constant
.
CONF_ROUTER_FILE_PATH
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment