Risk is minimal except possibly in cases where SocketChannels or ServerSocketChannels are obtained from a library and the consuming code is expecting InetSocketAddress as the only possible subtype of SocketAddress and the library instead provides channels to Unix domain sockets. It should be easy to work around this though.Risk is minimal except possibly in cases where SocketChannels or ServerSocketChannels are obtained from a library and the consuming code is expecting InetSocketAddress as the only possible subtype of SocketAddress and the library instead provides channels to Unix domain sockets. It should be easy to work around this though.
Add support for Unix domain sockets in java.nio.channels.SocketChannel and ServerSocketChannel as part of JEP 380.
NOTE This CSR was previously approved, but not integrated. It is being resubmitted to:
1) make some very small api changes (diffs from approved version are in attached api_v2.diffs)
2) define a new system/networking property, (described below in specification).
The original api webrev and specdiff are still attached.
The NEW api webrev and specdiff are attached in webrev.csr.final.v2.zip and specdiff.csr.final.v2.zip respectively and links to online versions of the same are provided below.
A small API change is required to support Unix domain sockets in NIO.
The spec change comprises:
- an additional enum value (UNIX) to java.net.StandardProtocolFamily
- a new sub-class of java.net.SocketAddress to represent Unix domain addresses
- additional normative text in SocketChannel and ServerSocketChannel describing the new behavior
- normative text in java.nio.channels package description
- additional target added to java.net.NetPermission
- additional supporting methods in the SPI
- a related extended socket option in jdk.net.ExtendedSocketOptions (being put here because not all platforms can support the option)
- new class jdk.net.UnixDomainPrincipal to support socket option above
Specdiff and webrev are attached. Links to external webrev and specdiff below.
OLD WEBREV and SPECDIFF (for reference only)
API WEBREV: http://cr.openjdk.java.net/~michaelm/8245194/api.webrev/webrev.csr.final/
NEW WEBREV and SPECDIFF (the spec)
API WEBREV: http://cr.openjdk.java.net/~michaelm/8245194/api.webrev/webrev.csr.final.v2/
See attached api_v2.diffs for API differences from approved version
New system/networking property as described in following text added to
# # Default directory where automatically bound Unix domain server # sockets are stored. Sockets are automatically bound when bound # with a null address. # # On Unix the search order to determine this directory is: # # 1. System property jdk.net.unixdomain.tmpdir # # 2. Networking property jdk.net.unixdomain.tmpdir specified # in this file (effective default) # # 3. System property java.io.tmpdir # jdk.net.unixdomain.tmpdir=/tmp
# # Default directory where automatically bound Unix domain server # sockets are stored. Sockets are automatically bound when bound # with a null address. # # The search order for the directory on Windows is: # # 1. System property "jdk.net.unixdomain.tmpdir" # # 2. Networking property "jdk.net.unixdomain.tmpdir" specified # in this file (not set by default) # # 3. The TEMP environment variable (the effective default) # # 4. The java.io.tmpdir system property # #jdk.net.unixdomain.tmpdir= #
- csr of
JDK-8245194 Unix domain socket channel implementation