+ // Reset and ignore our thread's interrupted flag.
+ // It's not possible to interrupt these sort of
+ // operations on Win32 anyway.
+ ::java::lang::Thread::interrupted();
+
Yuck! Does the Sun JRE really do this?
On both Linux and Windows, believe it ot not. Depending
on which day I wake up in the morning, it either makes
sense or doesn't. On the days it makes sense to me, I rationalize
it by saying: when you've completed the I/O operation in
question, it will never be prematurely (under Sun's JRE);
therefore, an interrupt status of true might mislead the caller
into thinking that the I/O was somehow prematurely interrupted,
which it wasn't.
Like you, I hoped the situation would improve for java.nio, but it
only has somewhat. My channels tests show that under Sun's JRE,
when you interrupt a thread that's blocked under Selector.select(),
you can reliably query the thread's interrupted status immediately
under Linux, but not on Windows.