Skip to content
Snippets Groups Projects
Commit 1a14f2f3 authored by 邹毅贤's avatar 邹毅贤
Browse files

lock optimize

parent e18a10b2
No related branches found
No related tags found
No related merge requests found
......@@ -204,9 +204,7 @@ func (r *zkRegistry) registerTempZookeeperNode(root string, node string) error {
zkPath string
)
r.cltLock.Lock()
client := r.client
r.cltLock.Unlock()
if client == nil {
return perrors.New("zk Client is null, can not process registerTempZookeeperNode ")
}
......@@ -260,9 +258,7 @@ func (r *zkRegistry) getListener(conf *common.URL) (*RegistryConfigurationListen
zkListener = NewRegistryConfigurationListener(r.client, r, conf)
if r.listener == nil {
r.cltLock.Lock()
client := r.client
r.cltLock.Unlock()
if client == nil {
return nil, perrors.New("zk connection broken")
}
......
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