RFR: 8344332: (bf) Migrate DirectByteBuffer to use java.lang.ref.Cleaner [v7]
Aleksey Shipilev
shade at openjdk.org
Wed Jan 22 17:50:54 UTC 2025
On Wed, 22 Jan 2025 17:23:53 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove vestigial reference to waitForReferenceProcessing in tests
>
> src/java.base/share/classes/java/nio/Bits.java line 160:
>
>> 158: } catch (InterruptedException e) {
>> 159: interrupted = true;
>> 160: break;
>
> I'm not sure that bailing out to throw OOME when interrupted is the right thing to do here. If ByteBuffer.allocateDIrect is called with the interrupt status set, or someone interrupts a thread while allocating on this slow path, then it would be surprising to have it throw OOME when it might have succeeded (with the interrupt status set).
Agreed. I thought I maintained the same interrupt behavior like before, but now I see old code does not bail on interrupt, it just restores the interrupt status on both failing and passing paths. Dropped this `break` in new commit.
> src/java.base/share/classes/java/nio/BufferCleaner.java line 48:
>
>> 46: }
>> 47:
>> 48: public static class Canary implements Runnable {
>
> Confusing for Canary to be public, it's not accessible outside of this package.
Right. Can be package-private. Done in new commit.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22165#discussion_r1925728413
PR Review Comment: https://git.openjdk.org/jdk/pull/22165#discussion_r1925728718
More information about the core-libs-dev
mailing list