On Wed, 21 Jun 2023 14:03:23 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Just a tiny clean-up to remove racy read within synchronized method
>
> src/java.base/share/classes/java/io/PipedOutputStream.java line 166:
> 
>> 164:     @Override
>> 165:     public synchronized void flush() throws IOException {
>> 166:         PipedInputStream sink = this.sink;
> 
> Suggestion:
> 
>         var sink = this.sink;
> 
> As seen in other methods.

On second thought, this is probably not necessary; write to the sink field is 
in another synchronized method, and this method is synchronized already. Is the 
goal here to remove the synchronized on flush?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14589#discussion_r1237103593

Reply via email to