Review Request : JDK-8002306, (se) Selector.open fails if invoked with thread interrupt status set [win]
Alan.Bateman at oracle.com
Tue Dec 11 02:18:08 PST 2012
On 10/12/2012 22:51, David M. Lloyd wrote:
> There will still be a race where the thread interrupt status could be
> set after it was cleared but before the selector is created.
If the interrupt status is set before the loopback connection is
established then it will just retry, if the interrupt status is setup
after the loopback connection is established then it doesn't matter.
There is of course the possibility that something is calling interrupt
continuously, in which case the Pipe.open might just end failing because
of connections in TIME_WAIT but that shouldn't be too common.
> I think there are probably only two viable options here:
> 1. Treat the current behavior as "correct": you cannot open a selector
> when the current thread is interrupted.
I don't think we need to go down that road, I've no doubt it would cause
> 2. Rewrite the selector open operation such that it creates the socket
> without respecting the state of the interrupted flag.
It's implementation specific that Pipe is implemented on Windows with a
socket connection (had to be done that way because Windows pipes can't
be multiplexed with sockets). It would be possible to change the Pipe
implementation to uses the low-level APIs, not sure if it's worth it.
More information about the nio-dev