[foreign-jextract] RFR: Improve NIO channel support for buffer views over segments

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Apr 21 15:37:25 UTC 2021


On Wed, 21 Apr 2021 15:07:32 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Initial prototype changes to use resource scope handles when performing I/O operations with synchronous and asynchronous channels.
>
> src/java.base/share/classes/java/nio/Buffer.java line 835:
> 
>> 833:                     try {
>> 834:                         targetScope.checkValidState();
>> 835:                     } catch (ScopedMemoryAccess.Scope.ScopedAccessError e) {   // ####: recheck thrown exs
> 
> Surprised to see this - your code should not be doing this - e.g. a failure in acquire() should trigger an ISE. Is the problem that you got the low level singleton exception (in which case that seems a bug in acquire()).

I double checked - we throw right exception when needed. I think you should just drop the manual call to `checkValidState` and leave that to `acquire`.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/512


More information about the panama-dev mailing list