RFR: 8344332: (bf) Migrate DirectByteBuffer to use java.lang.ref.Cleaner [v11]

Kim Barrett kbarrett at openjdk.org
Thu Jan 30 16:29:01 UTC 2025


On Thu, 30 Jan 2025 08:36:34 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> src/java.base/share/classes/java/nio/Bits.java line 146:
>> 
>>> 144:                 }
>>> 145: 
>>> 146:                 if (canary == null || canary.isDead()) {
>> 
>> If we're keeping Reference.waitForPendingReferences, why not continue to use it, rather than introducing
>> the canary as a new, ad hoc, reference processing progress detector?
>
> @kimbarrett Do you have a change coming to allow waitForPendingReferences be used by WB? I assume this will at least add a comment to the method (or whatever it changes to) to make it clear that it's for testing.

@AlanBateman I've not done any work on JDK-8305186.  There has also been discussion about making
that function non-private or even public (though with concerns about specification difficulty) for use in
places like this.

@shipilev I'm working on a reply, but it might be long-ish.  That outpacing issue for some tests is why this
code wasn't switched away from jdk.internal.ref.Cleaner a long time ago.  I'm still looking at it, but I currently
don't think the canary provides a reliable solution to that.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22165#discussion_r1935907473


More information about the nio-dev mailing list