Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
6bcd1ec4
Commit
6bcd1ec4
authored
Feb 27, 2021
by
wangwx
Browse files
Options
Downloads
Patches
Plain Diff
try to fix provider can't find error
parent
6553c224
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
protocol/dubbo/dubbo_invoker.go
+5
-2
5 additions, 2 deletions
protocol/dubbo/dubbo_invoker.go
protocol/dubbo/dubbo_protocol.go
+3
-1
3 additions, 1 deletion
protocol/dubbo/dubbo_protocol.go
remoting/exchange_client.go
+20
-1
20 additions, 1 deletion
remoting/exchange_client.go
with
28 additions
and
4 deletions
protocol/dubbo/dubbo_invoker.go
+
5
−
2
View file @
6bcd1ec4
...
...
@@ -196,10 +196,13 @@ func (di *DubboInvoker) Destroy() {
di
.
BaseInvoker
.
Destroy
()
client
:=
di
.
getClient
()
if
client
!=
nil
{
exchangeClientMap
.
Delete
(
di
.
GetUrl
()
.
Location
)
client
.
DecreaseActiveNumber
(
)
di
.
setClient
(
nil
)
if
client
.
GetActiveNumber
()
==
0
{
exchangeClientMap
.
Delete
(
di
.
GetUrl
()
.
Location
)
client
.
Close
()
}
}
})
}
...
...
This diff is collapsed.
Click to expand it.
protocol/dubbo/dubbo_protocol.go
+
3
−
1
View file @
6bcd1ec4
...
...
@@ -215,7 +215,9 @@ func getExchangeClient(url *common.URL) *remoting.ExchangeClient {
if
clientTmp
==
nil
{
return
nil
}
return
clientTmp
.
(
*
remoting
.
ExchangeClient
)
exchangeClient
:=
clientTmp
.
(
*
remoting
.
ExchangeClient
)
exchangeClient
.
IncreaseActiveNumber
()
return
exchangeClient
}
// rebuildCtx rebuild the context by attachment.
...
...
This diff is collapsed.
Click to expand it.
remoting/exchange_client.go
+
20
−
1
View file @
6bcd1ec4
...
...
@@ -18,6 +18,7 @@ package remoting
import
(
"errors"
"sync/atomic"
"time"
)
...
...
@@ -51,6 +52,8 @@ type ExchangeClient struct {
client
Client
// the tag for init.
init
bool
// the number of service using the exchangeClient
activeNum
uint32
}
// create ExchangeClient
...
...
@@ -59,6 +62,7 @@ func NewExchangeClient(url *common.URL, client Client, connectTimeout time.Durat
ConnectTimeout
:
connectTimeout
,
address
:
url
.
Location
,
client
:
client
,
activeNum
:
0
,
}
client
.
SetExchangeClient
(
exchangeClient
)
if
!
lazyInit
{
...
...
@@ -66,7 +70,7 @@ func NewExchangeClient(url *common.URL, client Client, connectTimeout time.Durat
return
nil
}
}
exchangeClient
.
IncreaseActiveNumber
()
return
exchangeClient
}
...
...
@@ -87,6 +91,21 @@ func (cl *ExchangeClient) doInit(url *common.URL) error {
return
nil
}
// increase number of service using client
func
(
client
*
ExchangeClient
)
IncreaseActiveNumber
()
{
atomic
.
AddUint32
(
&
client
.
activeNum
,
1
)
}
// decrease number of service using client
func
(
client
*
ExchangeClient
)
DecreaseActiveNumber
()
{
atomic
.
AddUint32
(
&
client
.
activeNum
,
^
uint32
(
0
))
}
// decrease number of service using client
func
(
client
*
ExchangeClient
)
GetActiveNumber
()
uint32
{
atomic
.
LoadUint32
(
&
client
.
activeNum
)
}
// two way request
func
(
client
*
ExchangeClient
)
Request
(
invocation
*
protocol
.
Invocation
,
url
*
common
.
URL
,
timeout
time
.
Duration
,
result
*
protocol
.
RPCResult
)
error
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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