Integrated: 8329190: (ch) DatagramChannel.receive should throw ClosedChannelException when called on closed channel

Mark Sheppard msheppar at openjdk.org
Tue Apr 16 15:47:03 UTC 2024


On Tue, 16 Apr 2024 12:03:07 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

> Please oblige and review the following changes (provided by Alan Bateman) which addresses the issue outlined in
> JDK-8329190: DatagramChannel.receive should throw ClosedChannelException when called on closed channel 
> 
> This ensures that a ClosedChannelException is consistently thrown from DatagramChannel send and receive methods, especially in the context of asynchronous closure and calling thread interruption.
> 
> The change is to move the ensureOpen() method call, which checks that a channel has not been closed, to the start of read/write send/receive methods on the DatagramChannel
> 
> The regression suites for jdk_nio and jdk_net and the JCK tests for api/java_nio api/java_net have been executed in repeat mode, multiple times, without any observed relevant failures.

This pull request has now been integrated.

Changeset: 90df3b7f
Author:    Mark Sheppard <msheppar at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/90df3b7fbb87f816f0bb688aa122cb3480399aee
Stats:     226 lines in 6 files changed: 223 ins; 0 del; 3 mod

8329190: (ch) DatagramChannel.receive should throw ClosedChannelException when called on closed channel

Co-authored-by: Alan Bateman <alanb at openjdk.org>
Reviewed-by: jpai, michaelm

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

PR: https://git.openjdk.org/jdk/pull/18796


More information about the nio-dev mailing list