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

(ch) Change channel close implementation to not wait for I/O threads

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 13
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b20

      Description

      This issue tracks changing the SelectableChannel close implementations to defer the final close when the channel is in blocking mode and there are threads in blocking I/O operations.

      Since JDK 11, async closing a channel configured blocking when there are threads doing I/O operations is:

      - preclose
      - signal
      - wait for I/O ops to complete
      - close if not registered with selector
      - deferred close if registered with selector (corner case that can arise if a key is cancelled and channel configured blocking before the key is flushed from the selector).

      With the proposal it changes to:

      - preclose
      - signal
      - deferred close

      The non-blocking channel case is unchanged, it remains:

      - wait for I/O ops to complete
      - deferred close if registered with selector

      The changes mean that the stateLock used in the channel implementations can be changed back to a built-in lock.

      Further discussion and review on the nio-dev list here:
      https://mail.openjdk.java.net/pipermail/nio-dev/2019-May/006120.html

        Attachments

          Activity

            People

            Assignee:
            alanb Alan Bateman
            Reporter:
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: