Should AbstractInterruptibleChannel.close() still use a synchronized block?
Mark Rotteveel
mark at lawinegevaar.nl
Wed Oct 18 13:03:27 UTC 2023
Prompted by this Stack Overflow question
[https://stackoverflow.com/q/77315894/466862], I'm wondering if the use
of a synchronized block in AbstractInterruptibleChannel.close() as-of
Java 21 is correct, and shouldn't be replaced with a ReentrantLock or
something else.
As shown in the question, closing of a channel derived from
AbstractInterruptibleChannel can cause pinning of virtual threads.
Mark
--
Mark Rotteveel
More information about the nio-dev
mailing list