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

/Claes

Reply via email to