RFR: 8360025: (se) Convert kqueue Selector Implementation to use FFM APIs

Darragh Clarke dclarke at openjdk.org
Tue Aug 12 11:16:13 UTC 2025


On Sat, 26 Jul 2025 07:46:25 GMT, ExE Boss <duke at openjdk.org> wrote:

>> This PR aims to Panamize the Java Kqueue implementation, This is based on the work that was previously shared in https://github.com/openjdk/jdk/pull/22307 , The main change since then is that this branch takes advantage of the changes made in https://github.com/openjdk/jdk/pull/25043 to allow for better performance during errno handling.
>> 
>> These changes feature a lot of Jextract generated files, though alterations have been made in relation to Errno handling and performance improvements.
>> 
>> I will update this description soon to include performance metrics on a few microbenchmarks, though currently it's roughly 2% to 3% slower with the changes, which is somewhat expected, though there are still a few ideas of possible performance improvements that could be tried. Any suggestions or comments in that area are more than welcome however.
>
> src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java line 44:
> 
>> 42: 
>> 43:     KQueuePoller(boolean subPoller, boolean read) throws IOException {
>> 44:         this.kqfd = kqueue_h.kqueue();
> 
> Note that the old implementation of `KQueue.create()` had a check for negative `kqfd`: <https://github.com/openjdk/jdk/blob/d288ca28be7bfba3abe9f54cefbe53e73c25707e/src/java.base/macosx/native/libnio/ch/KQueue.c#L63-L71>

Sorry for the delay in getting back to this, thanks for the comment though! I'll update the PR to include that again

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25546#discussion_r2269512920


More information about the nio-dev mailing list