From fb545e42912cc85007a02c1010b11ae560705210 Mon Sep 17 00:00:00 2001 From: Mukul Kumar Singh Date: Fri, 13 Oct 2017 12:10:33 +0530 Subject: [PATCH] HDFS-12415. Ozone: TestXceiverClientManager and TestAllocateContainer occasionally fails. Contributed by Mukul Kumar Singh. --- .../hadoop/ozone/scm/node/SCMNodeManager.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java index f818e7538c..ebe67c17b0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java @@ -20,7 +20,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.ThreadFactoryBuilder; -import org.apache.commons.collections.map.HashedMap; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.protocol.UnregisteredNodeException; import org.apache.hadoop.metrics2.util.MBeans; @@ -105,13 +104,13 @@ public class SCMNodeManager /** * Key = NodeID, value = timestamp. */ - private final Map healthyNodes; - private final Map staleNodes; - private final Map deadNodes; + private final ConcurrentHashMap healthyNodes; + private final ConcurrentHashMap staleNodes; + private final ConcurrentHashMap deadNodes; private final Queue heartbeatQueue; - private final Map nodes; + private final ConcurrentHashMap nodes; // Individual live node stats - private final Map nodeStats; + private final ConcurrentHashMap nodeStats; // Aggregated node stats private SCMNodeStat scmStat; // TODO: expose nodeStats and scmStat as metrics @@ -158,8 +157,8 @@ public SCMNodeManager(OzoneConfiguration conf, String clusterID) healthyNodes = new ConcurrentHashMap<>(); deadNodes = new ConcurrentHashMap<>(); staleNodes = new ConcurrentHashMap<>(); - nodes = new HashMap<>(); - nodeStats = new HashedMap(); + nodes = new ConcurrentHashMap<>(); + nodeStats = new ConcurrentHashMap(); scmStat = new SCMNodeStat(); healthyNodeCount = new AtomicInteger(0);