tillrohrmann commented on a change in pull request #10682: 
[FLINK-15247][Runtime] Wait for all slots to be free before task executor 
services shutdown upon stopping
URL: https://github.com/apache/flink/pull/10682#discussion_r362836388
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java
 ##########
 @@ -146,12 +149,7 @@ public void start(SlotActions initialSlotActions) {
        public void stop() {
                started = false;
                timerService.stop();
-               allocatedSlots
-                       .values()
-                       .stream()
-                       .filter(slot -> !taskSlots.containsKey(slot.getIndex()))
-                       .forEach(TaskSlot::close);
-               allocatedSlots.clear();
+               Preconditions.checkState(allocatedSlots.isEmpty(), "All slots 
have to be freed before stopping TaskSlotTable");
 
 Review comment:
   Here again, `stop` requires us to first clean up all `allocatedSlots`. I 
think this is not a good contract. Instead we should think about letting 
`TaskSlotTable` implement `AutoCloseableAsync` and to trigger the release of 
the `TaskSlots` when `stop` is being called.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to