RFR: 8245194: Unix domain socket channel implementation [v20]

Michael McMahon michaelm at openjdk.java.net
Wed Oct 14 16:23:21 UTC 2020


On Wed, 14 Oct 2020 11:19:59 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Michael McMahon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev
>> excludes the unrelated changes brought in by the merge/rebase. The pull request contains 22 additional commits since
>> the last revision:
>>  - Merge branch 'master' into unixdomainchannels
>>  - - reorganised the channel impls back into SocketChannelImpl and ServerSocketChannelImpl
>>    - removed the new Unix domain socket events and folded the behavior into the existing socket events
>>    - implemented other comments from Alan on Oct 11.
>>  - unixdomainchannels: updates from Chris's review 9 Oct 2020
>>  - unixdomainchannels:
>>    - updated property name
>>    - added JFR unit test
>>  - Merge branch 'master' into unixdomainchannels
>>  - - update after Alan's review on Oct 4
>>    - includes API change required by JDK-8251952
>>    - original CSR for the overall change will be resubmitted with
>>      all api changes consolidated based on this update
>>  - - simplified Copy.gmk to CAT source files directly
>>    - renamed net.properties source files to all be net.properties
>>  - unixdomainchannels: error in the last commit in make/modules/java.base/Copy.gmk
>>  - unixdomainchannels:
>>    (1) rename UnixDomainHelper to UnixDomainSocketsUtil
>>    (2) remove hardcoded /tmp and /var/tmp paths from UnixDomainSocketsUtil
>>    (3) replace (2) with documented system/networking properties
>>    (4) Small update to UnixDomainSocketAddress API
>>    (5) CSR for (3) and (4) submitted at JDK-8253930
>>    (6) Update build to generate net.properties from shared net.properties.common
>>        plus platform specific additions.
>>  - Merge branch 'master' into unixdomainchannels
>>  - ... and 12 more: https://git.openjdk.java.net/jdk/compare/a9828a5a...7f677d5a
>
> src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java line 99:
> 
>> 97:     // Binding
>> 98:     private SocketAddress localAddress; // null => unbound
>> 99:
> 
> See my previous comment about parameterization.

I think this change (parameterizing the SocketChannelImpl and Server) would be too disruptive for the benefit it
provides.

> src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 152:
> 
>> 150:         this.family = family;
>> 151:         this.fdVal = IOUtil.fdVal(fd);
>> 152:     }
> 
> If you introduced:
> private static FileDescriptor socketFor(ProtocolFamily family) throws IOException ...
> and
> private SocketChannelImpl(SelectorProvider sp, ProtocolFamily family, FileDescriptor fd) throws IOException {
>       super(sp);
>       this.family = family;
>       this.fd = fd;
>       this.fdVal = IOUtil.fdVal(fd);
>  }
> then you could move all the checking to `socketFor(ProtocolFamilly)` and write this constructor as:
> SocketChannelImpl(SelectorProvider sp, ProtocolFamily family) throws IOException {
>     this(sp, family, sockectFor(family));
> }
> which would push all the validation to **before** the object gets constructed.

Good idea.

-------------

PR: https://git.openjdk.java.net/jdk/pull/52


More information about the hotspot-jfr-dev mailing list