RFR: 8324972: (bf) Make DirectByteBuffer.Deallocator idempotent [v2]

Aleksey Shipilev shade at openjdk.org
Wed Jan 31 12:52:01 UTC 2024


On Wed, 31 Jan 2024 09:51:22 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Refrain from using AtomicBoolean
>
> src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template line 81:
> 
>> 79:     private static final class Deallocator implements Runnable {
>> 80: 
>> 81:         private static final AtomicIntegerFieldUpdater<Deallocator> UPDATER =
> 
> It would be possible to use `Unsafe` directly instead of AIFU.

+1, just use `Unsafe` directly here. `AIFU` would probably even worse than `AtomicInteger` if we want to minimize dependencies. We already use Unsafe in adjacent classes here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17647#discussion_r1472777492


More information about the nio-dev mailing list