-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
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
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