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

lock optimize

parent 9c623ec6
No related branches found
No related tags found
No related merge requests found
......@@ -487,9 +487,7 @@ func (z *ZookeeperClient) RegisterTempSeq(basePath string, data []byte) (string,
)
err = errNilZkClientConn
z.Lock()
conn := z.Conn
z.Unlock()
if conn != nil {
tmpPath, err = conn.Create(
path.Join(basePath)+"/",
......@@ -520,9 +518,7 @@ func (z *ZookeeperClient) GetChildrenW(path string) ([]string, <-chan zk.Event,
)
err = errNilZkClientConn
z.Lock()
conn := z.Conn
z.Unlock()
if conn != nil {
children, stat, watcher, err = conn.ChildrenW(path)
}
......@@ -556,9 +552,7 @@ func (z *ZookeeperClient) GetChildren(path string) ([]string, error) {
)
err = errNilZkClientConn
z.Lock()
conn := z.Conn
z.Unlock()
if conn != nil {
children, stat, err = conn.Children(path)
}
......@@ -589,9 +583,7 @@ func (z *ZookeeperClient) ExistW(zkPath string) (<-chan zk.Event, error) {
)
err = errNilZkClientConn
z.Lock()
conn := z.Conn
z.Unlock()
if conn != nil {
exist, _, watcher, err = conn.ExistsW(zkPath)
}
......
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