Github user enixon commented on the issue:

    https://github.com/apache/zookeeper/pull/611
  
    I see. It depends on what you are optimizing. The Watcher will be removed 
from watch2Paths when the ServerCnxn for it is closed. Keeping a set in the map 
for it strikes me as an optimization based on the heuristic that clients that 
create one watch are likely to make others and that the empty state of their 
watches is a temporary one. This is vulnerable to creep if connections only 
make single watches during their lifetime and do not renew when they're fired. 
    
    My inclination is to keep the current behavior. Far more often, a client 
workload requires re-establishing a watch after it has fired and the 
temporarily empty state of its watch set will soon pass. Aggressively cleaning 
up the map just makes more work in recreating entries and allocating new 
HashSets.


---

Reply via email to