Version 9

     

    Q1: On Java 5, why do I get a warning "The currently defined selector provider class (sun.nio.ch.PollSelectorProvider) is not supported with XNIO" when I create an instance of the XNIO NIO provider?

     

    A1: If you are using Sun Java 5 on the Linux or Mac OS X platform, the default NIO selector provider may still be based on the poll(2) system call.  In addition to having poor scalability characteristics, this provider also exhibits a problem in which closed connections do not always trigger a wakeup on any waiting readers.  The workaround for Linux is described in XNIO-67 - specify the new epoll-based provider using the correct system property like so:

     

    -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.EPollSelectorProvider

     

    For Mac OS X (Leopard), you want the KQueueSelectorProvider:

     

    -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.KQueueSelectorProvider

     


     

    Q2: What happens when I close the read side of a pipe or socket?

     

    A2: It depends on the platform.  On Linux, you'll get an IOException more or less immediately if you try to write to the write side after closing the read side.  On other platforms, an exception may be thrown later or not at all.  Overall, it's not a great idea to rely on specific behavior on the write side when the read end is closed.

     


     

    Q3: I am getting "No XNIO provider named 'nio' could be found" error when I try to create an Xnio instance.  What gives?

     

    A3: Very simple.  You forgot to include the xnio-nio.jar implementation JAR, or it's not on the classpath or otherwise not visible from the API JAR in your application.