Integrated: 8319757: java/nio/channels/DatagramChannel/InterruptibleOrNot.java failed: wrong exception thrown
Alan Bateman
alanb at openjdk.org
Sat Jan 6 08:55:33 UTC 2024
On Wed, 3 Jan 2024 19:29:08 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> InterruptibleOrNot.testInterruptBeforeInterruptibleReceive has failed a few times. It calls DatagramChannel.receive with the interrupt status set and expects ClosedByInterruptException to be thrown. The shared part of the test is also used for the non-interruptible scenario which needs a delayed close to ensure the thread calling receive wakes up. The 2s delay is not sufficient and thus it's possible for the async close to beat the detection of the interrupt status. This leads to AsynchronousCloseException instead of the expected ClosedByInterruptException.
>
> The test is re-worked to split the interruptible and non-interruptible tests. The test is also changed to drop the delayed interrupt/close and instead use a thread to poll under the target thread is in DatagramChannel.receive. The overall test is simpler. I changed it to be a JUnit test, that part is only a few lines of changes.
This pull request has now been integrated.
Changeset: ace010b3
Author: Alan Bateman <alanb at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/ace010b38a83e0c9b43aeeb6bc5c92d0886dc53f
Stats: 161 lines in 1 file changed: 55 ins; 29 del; 77 mod
8319757: java/nio/channels/DatagramChannel/InterruptibleOrNot.java failed: wrong exception thrown
Reviewed-by: jpai, bpb
-------------
PR: https://git.openjdk.org/jdk/pull/17251
More information about the nio-dev
mailing list