On Thu, 24 Nov 2022 14:56:07 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> src/java.base/share/classes/sun/nio/ch/IOUtil.java line 480:
>> 
>>> 478:     static MemorySessionImpl acquireScope(ByteBuffer bb, boolean 
>>> async) {
>>> 479:         if (async && NIO_ACCESS.isThreadConfined(bb)) {
>>> 480:             throw new IllegalStateException("Confined session not 
>>> supported");
>> 
>> No sure about ISE here. There is no mutable state on the input that would 
>> allow the acquire to succeed. I don't think anyone has run into it yet but 
>> we will need to look at the AsynchronousXXXX read/write methods to decide 
>> which exception to specify.
>
> This was the old behaviour which was retained in this PR.

I believe `UnsupportedOperationException` would be better for this.

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

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

Reply via email to