You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2021/02/01 20:12:24 UTC
[ambari] branch branch-2.7 updated: Fix
ConcurrentModificationException in HostRequest.getPhysicalTaskMapping
(#3281)
This is an automated email from the ASF dual-hosted git repository.
dmitriusan pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push:
new 00443cd Fix ConcurrentModificationException in HostRequest.getPhysicalTaskMapping (#3281)
00443cd is described below
commit 00443cdf7c858be31ee8b4d81b5adbd24eb83f52
Author: Suraj Naik <su...@gmail.com>
AuthorDate: Mon Feb 1 20:12:11 2021 +0000
Fix ConcurrentModificationException in HostRequest.getPhysicalTaskMapping (#3281)
Co-authored-by: Suraj Naik <su...@gmail.com>
Co-authored-by: Ramkrishna Vasudevan <ra...@hotmail.com>
Co-authored-by: Ramkrishna Vasudevan <ra...@hotmail.com>
---
.../src/main/java/org/apache/ambari/server/topology/HostRequest.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
index 13f89b5..62321c4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
@@ -27,6 +27,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import org.apache.ambari.server.actionmanager.HostRoleCommand;
import org.apache.ambari.server.actionmanager.HostRoleStatus;
@@ -81,7 +82,7 @@ public class HostRequest implements Comparable<HostRequest> {
Map<Long, HostRoleCommand> logicalTasks = new HashMap<>();
// logical task id -> physical tasks
- private Map<Long, Long> physicalTasks = new HashMap<>();
+ private Map<Long, Long> physicalTasks = new ConcurrentHashMap<>();
private List<TopologyHostTask> topologyTasks = new ArrayList<>();
@@ -455,7 +456,7 @@ public class HostRequest implements Comparable<HostRequest> {
}
public Map<Long, Long> getPhysicalTaskMapping() {
- return new HashMap<>(physicalTasks);
+ return new ConcurrentHashMap<>(physicalTasks);
}
//todo: since this is used to determine equality, using hashCode() isn't safe as it can return the same