RFR 8245194: Unix domain socket channel implementation

Alan Bateman Alan.Bateman at oracle.com
Mon Sep 14 08:52:25 UTC 2020


I'm still working through all the changes from the webrev (there are 87 
files changed and require a lot of effort to review). I realize the PR 
has an update, I'll get to that. For now, this mail is mostly on the 
changes to the existing SocketChannel and ServerSocketChannel 
implementations.

I don't particularly like the splitting up of SocketChannelImpl and 
ServerSocketChannelImpl but I agree it's probably the best approach to 
avoid having duplicate code in two implementations (as I think one of 
the early iterations had). So let's go with that.

The split means there is a round or two needed of cleanup. The ordering 
of the XXX and implXXX is inconsistent everywhere so let's try to fix 
that. Also the imports were copied and I assume should be trimmed. It 
would be good to use @Override consistently as it's really hard in some 
case to know what is being overridden in the Inet* and Unix* classes. I 
don't like it that finishAccept is no longer private but maybe it can be 
final to avoid mistakes?

I think UnixDomainNet should be renamed, maybe UnixDomainSockets because 
it defines static methods to operate on Unix domain sockets. The JNI 
natives are in UnixNet so I think they can be renamed too (btw: libnio 
should not be exporting NET_* functions, I'll get to that in the next 
mail). UnixDomainHelper is also a bit of an outlier, I think we'll need 
to find a better name or solution for that the charset issue.

Why does sun.nio.ch.Net need a static initializer to initialize 
UnixDomainNet? Maybe this is left over from a previous iteration.

The Unix version of Net.localAddress has been changed to check for a 
Unix domain socket, is this needed?

The Windows version of Net.c introduces "sockaddrall". Is that still 
needed? If so then I think it will require broader changes.

That's all for this area. I've been through the Unix domain socket 
implementation too, I'll try to write down comments on that shortly.

-Alan


More information about the nio-dev mailing list