normanmaurer commented on a change in pull request #753: ZOOKEEPER-3204: 
Reconfig tests are constantly failing on 3.5 after applying Java 11 fix
URL: https://github.com/apache/zookeeper/pull/753#discussion_r254270906
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/NettyServerCnxnFactory.java
 ##########
 @@ -528,14 +508,30 @@ private void addCnxn(NettyServerCnxn cnxn) {
         cnxns.add(cnxn);
         synchronized (ipMap){
             InetAddress addr =
-                ((InetSocketAddress)cnxn.channel.getRemoteAddress())
-                    .getAddress();
+                
((InetSocketAddress)cnxn.getChannel().remoteAddress()).getAddress();
             Set<NettyServerCnxn> s = ipMap.get(addr);
             if (s == null) {
-                s = new HashSet<NettyServerCnxn>();
+                s = new HashSet<>();
+                ipMap.put(addr, s);
             }
             s.add(cnxn);
-            ipMap.put(addr,s);
+        }
+    }
+
+    void removeCnxnFromIpMap(NettyServerCnxn cnxn, InetAddress remoteAddress) {
+        synchronized (ipMap) {
+            Set<NettyServerCnxn> s = ipMap.get(remoteAddress);
+            if (s != null) {
+                s.remove(cnxn);
+                if (s.isEmpty()) {
+                    ipMap.remove(remoteAddress);
+                }
+            } else {
+                LOG.error(
 
 Review comment:
   same comment applies for other areas.

----------------------------------------------------------------
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