Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8247942

Unix domain socket channel implementation

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 16
    • core-libs
    • None
    • source
    • minimal
    • Hide
      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.
      Show
      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.
    • Java API
    • SE

      Summary

      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.

      Problem

      A small API change is required to support Unix domain sockets in NIO.

      Solution

      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

      Specification

      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/

      SPECDIFF: http://cr.openjdk.java.net/~michaelm/8245194/specdiff/specdiff.csr.final/overview-summary.html

      NEW WEBREV and SPECDIFF (the spec)

      API WEBREV: http://cr.openjdk.java.net/~michaelm/8245194/api.webrev/webrev.csr.final.v2/

      SPECDIFF: http://cr.openjdk.java.net/~michaelm/8245194/specdiff/specdiff.csr.final.v2/overview-summary.html

      See attached api_v2.diffs for API differences from approved version

      New system/networking property as described in following text added to conf/net.properties

      Unix version

           #
           # 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

      Windows version

          #
          # 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=
          #

        1. api_v2.diffs
          3 kB
        2. specdiff.csr.final.v2.zip
          3.91 MB
        3. specdiff.zip
          1.30 MB
        4. webrev.csr.final.v2.zip
          343 kB
        5. webrev.zip
          426 kB

            michaelm Michael McMahon
            michaelm Michael McMahon
            Alan Bateman, Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: