RFR: 8330748: ByteArrayOutputStream.writeTo(OutputStream) pins carrier [v2]

Jason Mehrens duke at openjdk.org
Tue Apr 23 11:18:29 UTC 2024


On Mon, 22 Apr 2024 19:49:44 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Prevent blocking due to a carrier thread not being released when `ByteArrayOutputStream.writeTo` is invoked from a virtual thread.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Correct ID in test @bug tag

src/java.base/share/classes/java/io/ByteArrayOutputStream.java line 164:

> 162:     public void writeTo(OutputStream out) throws IOException {
> 163:         if (Thread.currentThread().isVirtual()) {
> 164:             out.write(toByteArray());

Would it be better to avoid calling a public method `toByteArray` encase subclass is overriding it?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18901#discussion_r1576078358


More information about the core-libs-dev mailing list