echauchot commented on a change in pull request #13040: URL: https://github.com/apache/flink/pull/13040#discussion_r493425466
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CompletedCheckpoint.java ########## @@ -210,6 +221,21 @@ public void registerSharedStatesAfterRestored(SharedStateRegistry sharedStateReg // Discard and Dispose // ------------------------------------------------------------------------ + /** + * Asynchronously call a discard on the ioExecutor + * (FixedThreadPool of configurable size of default 4*CPU cores) + * and count the number of checkpoints that are waiting to clean. + */ + void asyncDiscardCheckpointAndCountCheckpoint(ThrowingConsumer<CompletedCheckpoint, Exception> discardCallback, Executor executor){ + cleanCallback.accept(() -> { + try { + discardCallback.accept(this); Review comment: I tried this refactoring and I find weird to evaluate the conditions at several places I find it more clear to have conditions evaluated in the `discardOn*` methods and have these methods called as a whole. I prefer this even if it means having unnatural `discardCallback.accept(this);` So if you don't mind I'll leave it as it is. ---------------------------------------------------------------- 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