RFR: 8168640: (fc) Avoiding AtomicBoolean in FileInput/-OutputStream improves startup

Peter Levart peter.levart at gmail.com
Tue Oct 25 13:21:43 UTC 2016

On 10/25/2016 02:57 PM, Claes Redestad wrote:
>> FileChannelImpl.close() may be idempotent, but why not making sure it 
>> is called just once?
> Hmm, it would seem like a pre-existing issue that was not dealt with 
> neither before nor after JDK-8025619, no?
> And FileChannel inherits AbstractInterruptibleChannel::close() (public 
> final), which specifies behavior: "If the channel has already been 
> closed then this method returns immediately." Thus I don't think the 
> extra ceremony is warranted, won't you agree?
> Thanks!
> /Claes 

Ok, then what about a hint in the form of a brief comment that there is 
a race that might invoke FileChannelImpl.close() twice, but it is 
harmless as FileChannelImpl.close() is idempotent? It might be helpful 
to a future bug-hunter...

Regards, Peter

More information about the core-libs-dev mailing list