RFR: 8351458: (ch) Move preClose to UnixDispatcher

Alan Bateman alanb at openjdk.org
Mon Mar 10 14:47:28 UTC 2025


Network channels in blocking mode, and the NIO based SocketImpl, have to deal with async close when there are threads blocked on the channel. Virtual threads blocked on the channel need to be unparked. On Unix systems, platform threads blocked on the channel require the file descriptor to be dup'ed to a special file descriptor and the threads signalled.

There is a bit of duplication in the implementation of the 5 channels, and in the SocketImpl. In addition, there is discussion on net-dev about an issue in AIX that will require allowing for signals to be queued (the current implementation does not require OS to support queuing of signals).

We refactor this code so that the "prepare for close" is in one place, UnixDispatcher.

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

Commit messages:
 - Initial commit

Changes: https://git.openjdk.org/jdk/pull/23956/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23956&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8351458
  Stats: 163 lines in 12 files changed: 43 ins; 82 del; 38 mod
  Patch: https://git.openjdk.org/jdk/pull/23956.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23956/head:pull/23956

PR: https://git.openjdk.org/jdk/pull/23956


More information about the nio-dev mailing list