RFR[8246707]: '(sc) SocketChannel.read/write throws AsynchronousCloseException on closed channel'
Alan Bateman
Alan.Bateman at oracle.com
Fri Jul 31 17:26:20 UTC 2020
On 31/07/2020 16:16, Conor Cleary wrote:
>
> Hi guys,
>
> If you have a minute could you take a look at my new webrev for
> JDK-8246707 '(sc) SocketChannel.read/write throws
> AsynchronousCloseException on closed channel'?
>
> I updated the revision to include ensureOpenAndConnected() checks for
> blockingRead, blockingWriteFully and sendOutOfBandData before checking
> the blocking mode. Also, a test to check that a ClosedChannelException
> is thrown for read and write operations on a closed SocketChannel is
> now included (ReadWriteAfterClose.java).
>
> Thanks!
>
> bug: https://bugs.openjdk.java.net/browse/JDK-8246707
> webrev:
> http://cr.openjdk.java.net/~ccleary/issues/webrevs-store/8246707/webrevs/webrev.05/
>
Does the test fail without the changes? I'm asking because I assume
TestNG assertThrows(CCE, ...) will not fail when a sub-class of CCE is
thrown.
The changes to SocketChannelImpl look correct. One other thing is the
beginWrite at L1264 should be in try-finally block, not before. Minor
nit the comment at L1178 is for the isBlocking check, meaning
ensureOpenAndConnected should be before comment rather than after. I'd
prefer if there was an empty line after the ensureOpenAndConnect in both
blockingRead and blockingWriteFully to keep the style consistent.
-Alan.
More information about the nio-dev
mailing list