Patch that preserves Thread interrupt status and handles thread interrupts in non-interruptible methods according to Sun/Oracle handbook.
This problem exists in more places at Lucene also test failures caused by this.
There is a reason why InterruptedException is checked. We convert it to unchecked by wrapping with ThreadInterruptedException. But thats the wrong way to do. InterruptedException is checked, because on interrupting such a method that explicitely declares InterruptedException, you have to take care, otherwoise you hide interrupts. Simon already has a patch to cleanup (not yet committed, also addressing this issue).
If you have a methods that is defined to not be interruptible, like Closeable#close() [interface dictates!], you are not allowe d to interrupt. The correct way to handle this is to save interrupt status on entering method, then call the interruptible things like wait(), join() but repeat them on a new interrupt (so make then non-interruptible). And finally reset the interrupt status to the previous one including new interrupts (see examples in patch).
If we would not have hidden the InterruptedException in IndexWriter's close() - he issue we have here would not be there.
One example also violating the close()-not-interruptible is e.g. NRTManagerReopenThread. If you call close() and interrupt that, the thread leaks because it no longer waits for it to finish. We have similar leaks in TestDocumentsWriterStallControl. This should be fixed by nuking the RuntimeExSubclass and handle all interrupts correctly (it's easy, you have to know how).
I will open issue once this issue is solved.