6979009: (fc) FileChannel.read() fails to throw ClosedByInterruptException

Alan Bateman Alan.Bateman at oracle.com
Tue Nov 9 08:33:30 PST 2010


Chris Hegarty wrote:
> :
> It seems unnecessary (but not wrong) to pass the current thread to the 
> interruptor in AbstractSelector, null would be sufficient.
Yes, null would do too but it really doesn't matter because it's not 
used for this case.

>
> Would it be overkill/wrong to have a list of interrupted threads? 
> Instead of just the last interrupted thread getting 
> ClosedByInterruptException.
It's only possible to close the channel once and only one thread should 
throw ClosedByInterruptException. If several threads doing I/O on the 
same channel are interrupted at around the same time then first thread, 
calling Thread.interrupt, to acquite clockLock will set the victim and 
it's that thread that will throw ClosedByInterruptException. To the 
other threads its just like an asynchronous close, irrespective of if 
they have been interrupted too.

-Alan.




More information about the nio-dev mailing list