zonghaishang opened a new issue #1517: Zookeeper query map too many times
URL: https://github.com/apache/incubator-dubbo/issues/1517
 
 
   see com.alibaba.dubbo.registry.zookeeperZookeeperRegistry#doSubscribe
   ``` java
   ConcurrentMap<NotifyListener, ChildListener> listeners = 
zkListeners.get(url);
   if (listeners == null) {
         zkListeners.putIfAbsent(url, new ConcurrentHashMap<NotifyListener, 
ChildListener>());
          listeners = zkListeners.get(url);
   }
   ```
   "zkListeners.get(url)" query map too many times,  it can be done only once. 
We can use java.util.concurrent.ConcurrentMap#putIfAbsent method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to