HDDS-1752. ConcurrentModificationException while handling DeadNodeHandler event. (#1080)

This commit is contained in:
Hrishikesh Gadre 2019-07-12 01:45:48 -07:00 committed by Nanda kumar
parent 738fab3bff
commit 14c43f85de
1 changed files with 2 additions and 2 deletions

View File

@ -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.Pipeline;
import org.apache.hadoop.hdds.scm.pipeline.PipelineID; import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* This data structure maintains the list of pipelines which the given * This data structure maintains the list of pipelines which the given
@ -59,7 +59,7 @@ public class Node2PipelineMap extends Node2ObjectsMap<PipelineID> {
public synchronized void addPipeline(Pipeline pipeline) { public synchronized void addPipeline(Pipeline pipeline) {
for (DatanodeDetails details : pipeline.getNodes()) { for (DatanodeDetails details : pipeline.getNodes()) {
UUID dnId = details.getUuid(); UUID dnId = details.getUuid();
dn2ObjectMap.computeIfAbsent(dnId, k -> new HashSet<>()) dn2ObjectMap.computeIfAbsent(dnId, k -> ConcurrentHashMap.newKeySet())
.add(pipeline.getId()); .add(pipeline.getId());
} }
} }