mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8334719: (se) Deferred close of SelectableChannel may result in a Selector doing the final close before concurrent I/O on channel has completed
Co-authored-by: Alan Bateman <alanb@openjdk.org> Reviewed-by: alanb, dfuchs
This commit is contained in:
parent
6682305ee2
commit
9bb675f89d
7 changed files with 705 additions and 0 deletions
|
@ -201,6 +201,9 @@ class SinkChannelImpl
|
|||
|
||||
@Override
|
||||
public void kill() {
|
||||
// wait for any write operation to complete before trying to close
|
||||
writeLock.lock();
|
||||
writeLock.unlock();
|
||||
synchronized (stateLock) {
|
||||
if (state == ST_CLOSING) {
|
||||
tryFinishClose();
|
||||
|
|
|
@ -200,6 +200,9 @@ class SourceChannelImpl
|
|||
}
|
||||
@Override
|
||||
public void kill() {
|
||||
// wait for any read operation to complete before trying to close
|
||||
readLock.lock();
|
||||
readLock.unlock();
|
||||
synchronized (stateLock) {
|
||||
assert !isOpen();
|
||||
if (state == ST_CLOSING) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue