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

Xueming Shen xueming.shen at oracle.com
Mon Nov 8 17:16:02 PST 2010


  138             } catch (ClosedByInterruptException e) {
  139                 if (interruptible) {
  140                     if (Thread.currentThread().isInterrupted()) {
  141                         expected(e + " thrown and interrupt status set");
  142                     } else {
  143                         unexpected(e + " thrown but interrupt status not set");
  144                     }
  145                 } else {
  146                     expected(e);
  147                 }

Shouldn't #146 be unexpected(e)?


-Sherman

On 11/7/2010 04:14, Alan Bateman wrote:
>
> I've been talking to Dag Wanvik (Derby/Java DB project) about some 
> issues that they are seeing when threads doing I/O with a FileChannel 
> are interrupted. They periodically see the channel being "silently 
> closed" and also spurious ClosedByInterruptExceptions thrown by other 
> threads doing I/O that are not interrupted. As it turns out there is a 
> small rat's nest that has always been there. The following changes fix 
> these issues so that ClosedByInterruptException is consistently 
> thrown, and only by the thread that is interrupted. We may need to 
> follow this up with a spec clarification for the case that a thread is 
> interrupted at just around the time that an I/O completes.
>
> http://cr.openjdk.java.net/~alanb/6979009/webrev/
>
> Thanks,
> Alan.



More information about the nio-dev mailing list