On Fri, 7 Mar 2025 23:17:53 GMT, Kim Barrett <kbarr...@openjdk.org> wrote:
> Please review this revision of a previously puzzling comment intending to > provide the rationale for a bit of non-obvious code. src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 142: > 140: // while there are registered cleanables for other > objects. > 141: // If the application cleans all remaining cleanables, > there > 142: // won't be any references enqueued to unblock this. > Using a I agree that calling `queue.remove()` with a timeout is the right approach. But I have a question: In the case where the Cleaner's `CleanerCleanable` has already run, and we get to processing the last registered cleanable on `activeList`: When we do the `ref.clean()`, the `activeList` becomes empty, and we'll drop out of the `while()` loop. So I'm not seeing how we would attempt another `queue.remove()` in this case. What am I missing? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23952#discussion_r1988140719