From 14c43f85de86c8547dd23e228584cc5e83449870 Mon Sep 17 00:00:00 2001 From: Hrishikesh Gadre Date: Fri, 12 Jul 2019 01:45:48 -0700 Subject: [PATCH] HDDS-1752. ConcurrentModificationException while handling DeadNodeHandler event. (#1080) --- .../apache/hadoop/hdds/scm/node/states/Node2PipelineMap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/Node2PipelineMap.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/Node2PipelineMap.java index 20fe797c38d..f8633f9fcbc 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/Node2PipelineMap.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/Node2PipelineMap.java @@ -22,9 +22,9 @@ import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.pipeline.Pipeline; import org.apache.hadoop.hdds.scm.pipeline.PipelineID; -import java.util.HashSet; import java.util.Set; import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; /** * This data structure maintains the list of pipelines which the given @@ -59,7 +59,7 @@ public class Node2PipelineMap extends Node2ObjectsMap { public synchronized void addPipeline(Pipeline pipeline) { for (DatanodeDetails details : pipeline.getNodes()) { UUID dnId = details.getUuid(); - dn2ObjectMap.computeIfAbsent(dnId, k -> new HashSet<>()) + dn2ObjectMap.computeIfAbsent(dnId, k -> ConcurrentHashMap.newKeySet()) .add(pipeline.getId()); } }