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 <[email protected]>
AuthorDate: Mon Feb 1 20:12:11 2021 +0000
Fix ConcurrentModificationException in HostRequest.getPhysicalTaskMapping
(#3281)
Co-authored-by: Suraj Naik <[email protected]>
Co-authored-by: Ramkrishna Vasudevan <[email protected]>
Co-authored-by: Ramkrishna Vasudevan <[email protected]>
---
.../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