RFR [10]: 8185362: Replace use of AtomicReferenceFieldUpdater from BufferedInputStream with Unsafe

Claes Redestad claes.redestad at oracle.com
Mon Aug 21 15:00:37 UTC 2017

On 08/21/2017 04:47 PM, Peter Levart wrote:
> Is BufferedInputStream.close() intentionally not synchronized? All 
> other methods are. If close() was synchronized too, no CAS would be 
> needed and fields could be normal, not volatile. What is achieved by 
> close() not being synchronized? Fear of deadlocks? 

I don't have the history here, but my gut-feeling is it's intentional to 
allow calling close on streams that are blocked or waiting for data from 
another thread in a non-blocking (or even deadlocking) fashion


More information about the core-libs-dev mailing list