You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2017/06/22 22:57:55 UTC

[36/50] [abbrv] helix git commit: Make map in NotificationContext synchronized

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 <jx...@linkedin.com>
Authored: Fri May 12 11:49:01 2017 -0700
Committer: Junkai Xue <jx...@linkedin.com>
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<String, Object>();
+    _map = new ConcurrentHashMap<String, Object>();
   }
 
   /**