This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new dee3b46f82 AMBARI-25613: Fix ConcurrentModificationException in 
HostRequest.getPhysicalTaskMapping (#3395)
dee3b46f82 is described below

commit dee3b46f829f91060f7ad4cd81af9df4248ad681
Author: Zhiguo Wu <wuzhi...@apache.org>
AuthorDate: Sun Oct 16 02:46:43 2022 +0800

    AMBARI-25613: Fix ConcurrentModificationException in 
HostRequest.getPhysicalTaskMapping (#3395)
---
 .../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 13f89b5fbf..62321c43cf 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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@ambari.apache.org
For additional commands, e-mail: commits-h...@ambari.apache.org

Reply via email to