RFR: 8344328: (dc) DatagramChannelImpl.blockingReceive can now synchronize on packet [v2]

Daniel Fuchs dfuchs at openjdk.org
Thu Nov 21 15:10:19 UTC 2024


On Wed, 20 Nov 2024 17:31:06 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> The read/write lock used by DatagramChannel is not exposed so the ordering is hard to observe. In any case, I think what we have in the PR aligns with the locking that has been there since JDK 1.0. That is, it does in synchronized (p) in DatagramSocketAdaptor.send/receive It's a bit icky as the blockingXXX methods needs to assert that the current thread holds the lock, and doing in blockingXXX would work the same (the difference is not observable).

I see. I'm OK with both solutions - so choose the one you like more and I will (re-)approve if needed.

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

PR Comment: https://git.openjdk.org/jdk/pull/22212#issuecomment-2491485296


More information about the nio-dev mailing list