Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F1821200C44 for ; Mon, 27 Mar 2017 20:19:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F03B5160B85; Mon, 27 Mar 2017 18:19:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 69326160B7B for ; Mon, 27 Mar 2017 20:19:10 +0200 (CEST) Received: (qmail 37727 invoked by uid 500); 27 Mar 2017 18:19:04 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 37712 invoked by uid 99); 27 Mar 2017 18:19:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Mar 2017 18:19:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 327EFDFBCA; Mon, 27 Mar 2017 18:19:04 +0000 (UTC) From: eribeiro To: dev@zookeeper.apache.org Reply-To: dev@zookeeper.apache.org References: In-Reply-To: Subject: [GitHub] zookeeper pull request #208: ZOOKEEPER-2280: NettyServerCnxnFactory doesn't ... Content-Type: text/plain Message-Id: <20170327181904.327EFDFBCA@git1-us-west.apache.org> Date: Mon, 27 Mar 2017 18:19:04 +0000 (UTC) archived-at: Mon, 27 Mar 2017 18:19:11 -0000 Github user eribeiro commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/208#discussion_r108242052 --- Diff: src/java/main/org/apache/zookeeper/server/NettyServerCnxn.java --- @@ -100,11 +101,15 @@ public void close() { + Long.toHexString(sessionId)); } - synchronized (factory.ipMap) { - Set s = - factory.ipMap.get(((InetSocketAddress)channel - .getRemoteAddress()).getAddress()); - s.remove(this); + InetAddress address = ((InetSocketAddress) channel.getRemoteAddress()).getAddress(); + Set s = factory.ipMap.get(address); + if (s != null) { + synchronized (s) { --- End diff -- Yeah... in the context of this call I think it is not necessary to synchronize here if -- as you said -- we use a synchronized set (**currently it's not**). I would also change `ipMap` to be a `ConcurrentMap` but unsure if it's worth the effort, tbh. :thinking: thoughts? --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. ---