RFR 8231187: SelectorProvider.inheritedChannel() returns TCP socket channel for Unix domain socket

Michael McMahon michael.x.mcmahon at oracle.com
Mon Sep 23 16:56:35 UTC 2019


Okay, I see the reason for it now. It is the potential race when closing 
a socket
and its file descriptor possibly being reassigned to another opened 
file, at the same time
as another thread starting an I/O operation on the original socket.

I have added the two stage close logic similar to SocketChannel and the 
Source/SinkChannels you
mentioned.

Updated webrev at: 
http://cr.openjdk.java.net/~michaelm/8231187/webrev.2/index.html

Thanks,
Michael.

On 20/09/2019, 13:20, Alan Bateman wrote:
> On 20/09/2019 11:56, Michael McMahon wrote:
>>
>> Is the above not required only to allow draining of the socket when 
>> SO_LINGER is enabled,
>> which is not supported in this case?
> It's needed to coordinate closing with threads that are doing blocking 
> I/O on the channel. SourceChannelImpl and SinkChannelImpl are good 
> starting point because they are close to what you want, without all 
> the additional details that SocketChannelImpl needs to be concerned with.
>
> -Alan


More information about the nio-dev mailing list