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 885CB200CBE for ; Fri, 23 Jun 2017 00:57:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 86D60160BF4; Thu, 22 Jun 2017 22:57:25 +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 86B87160C11 for ; Fri, 23 Jun 2017 00:57:23 +0200 (CEST) Received: (qmail 77843 invoked by uid 500); 22 Jun 2017 22:57:22 -0000 Mailing-List: contact commits-help@helix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@helix.apache.org Delivered-To: mailing list commits@helix.apache.org Received: (qmail 77602 invoked by uid 99); 22 Jun 2017 22:57:22 -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; Thu, 22 Jun 2017 22:57:22 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7FDF0E96B8; Thu, 22 Jun 2017 22:57:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jxue@apache.org To: commits@helix.apache.org Date: Thu, 22 Jun 2017 22:57:55 -0000 Message-Id: <53a292178ff746b0b6f3797d408a85b8@git.apache.org> In-Reply-To: <173dae016db149ebb905028df29fb355@git.apache.org> References: <173dae016db149ebb905028df29fb355@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [36/50] [abbrv] helix git commit: Make map in NotificationContext synchronized archived-at: Thu, 22 Jun 2017 22:57:25 -0000 Make map in NotificationContext synchronized One issue we observed is that when batch messages enabled, it will have NPE in ZNRecord merge record. Race condition could be the root cause. The only place can have race condition is the current state update map in NotificationContext, which is passed as input for multiple sub tasks in BatchMessageHandler. Project: http://git-wip-us.apache.org/repos/asf/helix/repo Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/173065e3 Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/173065e3 Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/173065e3 Branch: refs/heads/master Commit: 173065e3a4e5af6f6d0d9b2cf5112ff61b980adb Parents: 7fc4a8a Author: Junkai Xue Authored: Fri May 12 11:49:01 2017 -0700 Committer: Junkai Xue Committed: Fri May 12 11:49:01 2017 -0700 ---------------------------------------------------------------------- .../src/main/java/org/apache/helix/NotificationContext.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/helix/blob/173065e3/helix-core/src/main/java/org/apache/helix/NotificationContext.java ---------------------------------------------------------------------- diff --git a/helix-core/src/main/java/org/apache/helix/NotificationContext.java b/helix-core/src/main/java/org/apache/helix/NotificationContext.java index a67cae9..ae1e965 100644 --- a/helix-core/src/main/java/org/apache/helix/NotificationContext.java +++ b/helix-core/src/main/java/org/apache/helix/NotificationContext.java @@ -21,6 +21,7 @@ package org.apache.helix; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * Metadata associated with a notification event and the current state of the cluster @@ -64,7 +65,7 @@ public class NotificationContext { */ public NotificationContext(HelixManager manager) { _manager = manager; - _map = new HashMap(); + _map = new ConcurrentHashMap(); } /**