RFR: 8306308: (ch) Writer created by Channels::newWriter may lose data [v3]
Alan Bateman
alanb at openjdk.org
Thu Oct 19 07:40:28 UTC 2023
On Wed, 18 Oct 2023 20:40:23 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Change `Channels.newWriter` to return a `Writer` created by first wrapping the `WritableByteChannel` in an `OutputStream` using `Channels.newOutputStream` and then wrapping the result in an `OutputStreamWriter`. With this change in place, the problems reported in the issue do not occur.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8306308: Add some code to dispense with lock
I think this looks quite good.
BTW: Do we have tests with SocketChannels configured non-blocking that will check that IllegalBlockingMode is thrown?
src/java.base/share/classes/sun/nio/cs/StreamEncoder.java line 249:
> 247: private final int maxBufferCapacity;
> 248:
> 249: // This must be non-null
I think you can drop that comment now, it only made sense when one is non-null.
-------------
Marked as reviewed by alanb (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/16207#pullrequestreview-1686940025
PR Comment: https://git.openjdk.org/jdk/pull/16207#issuecomment-1770237797
PR Review Comment: https://git.openjdk.org/jdk/pull/16207#discussion_r1365049207
More information about the nio-dev
mailing list