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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • None
    • core-libs
    • b20

      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

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

              Created:
              Updated:
              Resolved: