Github user eribeiro commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/208#discussion_r108256234
  
    --- Diff: 
src/java/main/org/apache/zookeeper/server/NettyServerCnxnFactory.java ---
    @@ -524,17 +538,14 @@ public InetSocketAddress getLocalAddress() {
     
         private void addCnxn(NettyServerCnxn cnxn) {
             cnxns.add(cnxn);
    -        synchronized (ipMap){
    -            InetAddress addr =
    -                ((InetSocketAddress)cnxn.channel.getRemoteAddress())
    -                    .getAddress();
    -            Set<NettyServerCnxn> s = ipMap.get(addr);
    -            if (s == null) {
    -                s = new HashSet<NettyServerCnxn>();
    -            }
    -            s.add(cnxn);
    -            ipMap.put(addr,s);
    +
    +        InetAddress addr = 
((InetSocketAddress)cnxn.channel.getRemoteAddress()).getAddress();
    --- End diff --
    
    Indeed, there's too much call for casting in this class already. Are you 
suggesting to extract this line into a method?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to