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

Viktor Klang vklang at openjdk.org
Tue Apr 23 09:45:30 UTC 2024


On Tue, 23 Apr 2024 07:27:02 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> > Has the alternative of moving to a j.u.c.Lock (Needs Reentrant or not?) been explored/benchmarked?
> 
> Yes, decided not to do because it's just guarding access to a byte[] and any changes can influence the inlining. Plus, it would need to continue to use monitors when extended as the subclass may assume synchronization in the super class. Limiting it to just the problematic writeTo method seem the least risky.

That's true, good points across the board.

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

PR Comment: https://git.openjdk.org/jdk/pull/18901#issuecomment-2071869067


More information about the core-libs-dev mailing list