I want to interrupt an accept()-operation on a ServerSocketChannel with jdk14.

Simon Ablett

Interrupting blocked IO operations is dangerous as it could leave the supplier/receiver in an indeterminate state (imagine interrupting a database operation). I'm not sure of an alternative solution other than to set a low timeout for the operation (where applicable) and then catch the resultant exception. As an aside, under Solaris, generating an interrupt against a thread that's in a blocked IO operation results in an InterruptedIOException being thrown (rather than an InterruptedException). This is different to all other implementations which don't allow such operations to be interrupted and will, I believe, be deprecated at some point.