zhuzhurk commented on code in PR #20296:
URL: https://github.com/apache/flink/pull/20296#discussion_r932833249


##########
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/JobVertexTaskManagersHandler.java:
##########
@@ -131,18 +132,23 @@ private static JobVertexTaskManagersInfo 
createJobVertexTaskManagersInfo(
         Map<String, String> taskManagerId2Host = new HashMap<>();
         Map<String, List<AccessExecutionVertex>> taskManagerVertices = new 
HashMap<>();
         for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) {
-            TaskManagerLocation location = 
vertex.getCurrentAssignedResourceLocation();
-            String taskManagerHost =
-                    location == null
-                            ? "(unassigned)"
-                            : location.getHostname() + ':' + 
location.dataPort();
-            String taskmanagerId =
-                    location == null ? "(unassigned)" : 
location.getResourceID().toString();
-            taskManagerId2Host.put(taskmanagerId, taskManagerHost);
-            List<AccessExecutionVertex> vertices =
-                    taskManagerVertices.computeIfAbsent(
-                            taskmanagerId, ignored -> new ArrayList<>(4));
-            vertices.add(vertex);
+            List<TaskManagerLocation> locations =
+                    vertex.getCurrentExecutions().stream()
+                            .map(AccessExecution::getAssignedResourceLocation)
+                            .collect(Collectors.toList());
+            for (TaskManagerLocation location : locations) {
+                String taskManagerHost =
+                        location == null
+                                ? "(unassigned)"
+                                : location.getHostname() + ':' + 
location.dataPort();
+                String taskmanagerId =
+                        location == null ? "(unassigned)" : 
location.getResourceID().toString();
+                taskManagerId2Host.put(taskmanagerId, taskManagerHost);
+                List<AccessExecutionVertex> vertices =
+                        taskManagerVertices.computeIfAbsent(
+                                taskmanagerId, ignored -> new ArrayList<>(4));

Review Comment:
   It should be avoided according to the code style guide.
   
https://flink.apache.org/contributing/code-style-and-quality-java.html#collections



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to