Skip to content
Snippets Groups Projects
Commit 17a63bf2 authored by xujianhai666's avatar xujianhai666
Browse files

feat(dubbo/invoker): 修改dubbo 关闭的方式

parent 4014c59d
No related branches found
No related tags found
No related merge requests found
......@@ -42,8 +42,8 @@ var (
type DubboInvoker struct {
protocol.BaseInvoker
client *Client
destroyLock sync.Mutex
client *Client
quitOnce sync.Once
}
func NewDubboInvoker(url common.URL, client *Client) *DubboInvoker {
......@@ -97,19 +97,11 @@ func (di *DubboInvoker) Invoke(invocation protocol.Invocation) protocol.Result {
}
func (di *DubboInvoker) Destroy() {
if di.IsDestroyed() {
return
}
di.destroyLock.Lock()
defer di.destroyLock.Unlock()
if di.IsDestroyed() {
return
}
di.quitOnce.Do(func() {
di.BaseInvoker.Destroy()
di.BaseInvoker.Destroy()
if di.client != nil {
di.client.Close() // close client
}
if di.client != nil {
di.client.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