On Mon, 10 May 2021 23:25:46 GMT, Liam Miller-Cushon <[email protected]> wrote:
> 8266857: PipedOutputStream.sink should be volatile
For correctness (and peace of mind)- we should probably introduce a local
variable in all the places where `sink` is read more than once outside of a
synchronized block (the two `write` and `close` methods).
I'd suggest simply inserting a first line in each of these methods:
var sink = this.sink;
This will ensure that there's only one volatile read.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3960