tillrohrmann commented on a change in pull request #13124: URL: https://github.com/apache/flink/pull/13124#discussion_r469189569
########## File path: flink-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java ########## @@ -163,9 +163,9 @@ protected final void addCloseableInternal(Closeable closeable, T metaData) { /** * Removes a mapping from the registry map, respecting locking. */ - protected final void removeCloseableInternal(Closeable closeable) { + protected final boolean removeCloseableInternal(Closeable closeable, T object) { synchronized (getSynchronizationLock()) { - closeableToRef.remove(closeable); + return closeableToRef.remove(closeable, object); Review comment: I think that it should not matter whether the old or new phantom reference gets enqueued and triggers the clean up because the clean up will only be triggered once the object is phantom reachable and there is coming back from this state. Hence, I think we don't need this safeguard if I am not mistaken. If these methods are not tested yet, then I could help introducing them in order to guard our assumptions here. ---------------------------------------------------------------- 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