<div dir="ltr"><div dir="ltr"><div dir="ltr"><a href="https://github.com/dreamlike-ocean/PanamaUring/blob/master/src/test/java/FileTest.java" target="_blank">PanamaUring/FileTest.java at master · dreamlike-ocean/PanamaUring (github.com)</a></div><div dir="ltr">just like this toy code,Use epoll to handle network io, use io_uring to handle file io, and use eventfd to allow epoll to monitor the completion of io_uring。</div><div dir="ltr">When the eventfd is obtained through epoll_wait, call the io_uring_peek_cqe method</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Alan Bateman <<a href="mailto:Alan.Bateman@oracle.com">Alan.Bateman@oracle.com</a>> 于2022年10月7日周五 15:48写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 06/10/2022 20:19, dreamlike_ocean lei wrote:<br>
> hi,I found that the implementation of "sun.nio.ch.PollerProvider" can <br>
> be specified through "jdk.PollerProvider", but the interface of <br>
> PollerProvider is not public, so how do I pass my poller to jvm?<br>
> My purpose is to add io_uring as an implementation of poller, so that <br>
> I can poll both network IO and file IO using the same thread,and dont <br>
> worry carrier will be pinned by file io。<br>
><br>
<br>
There isn't an exported service provider interface here. The <br>
Poller/PollerProvider code is just the JDK's implementation with some <br>
basic support to allow a JDK build to include alternative <br>
implementations.  This shouldn't stop you experimenting with your own <br>
implementation in your own module/package as the primitives that you <br>
need to park/unpark are already defined by j.u.c.LockSupport.<br>
<br>
Just on io_uring. We do have a prototype implementation of the JDK <br>
PollerProvider that uses io_uring and works as an alternative to the <br>
epoll based implementation. That's for network sockets, not files, as <br>
Poller isn't for async I/O. The integration for files is very different <br>
and involves some significant refactoring of JDK code to support so <br>
there is a lot more to that. It will be interesting to hear how you get <br>
on with file I/O.<br>
<br>
-Alan<br>
</blockquote></div>