tillrohrmann commented on a change in pull request #9072: [FLINK-11630] Wait 
for the termination of all running Tasks when shutting down TaskExecutor
URL: https://github.com/apache/flink/pull/9072#discussion_r313899846
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
 ##########
 @@ -1826,4 +1838,30 @@ public SlotReport retrievePayload(ResourceID 
resourceID) {
                        return taskSlotTable.createSlotReport(getResourceID());
                }
        }
+
+       private static class TaskCompletionTracker {
+               private final Map<ExecutionAttemptID, Task> incompleteTasks;
+
+               private TaskCompletionTracker() {
+                       incompleteTasks = new ConcurrentHashMap<>(8);
+               }
+
+               void trackTaskCompletion(Task task) {
+                       incompleteTasks.put(task.getExecutionId(), task);
+                       task.getTerminationFuture().thenRun(() -> 
incompleteTasks.remove(task.getExecutionId()));
 
 Review comment:
   could we also rely on `TaskExecutor#unregisterTaskAndNotifyFinalState` to 
remove the task from the `TaskCompletionTracker`? That way we would not apply 
concurrent changes to `incompleteTasks`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to