Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Java's NIO package (as of Java6), provides support for <em>non-blocking I/O</em> only, via <a href="http://java.sun.com/javase/6/docs/api/java/nio/channels/Selector.html" rel="noreferrer">Selector</a>s. Java7 is hopefully going to ship with NIO.2, which includes asynchronous I/O support. Today, your best bet is to make use of a framework. ARMistice mentioned Mina. Here are some others.</p> <ol> <li><a href="http://grizzly.java.net/" rel="noreferrer">Grizzly</a>. This is the I/O core for Sun's <a href="http://glassfish.java.net/" rel="noreferrer">GlassFish</a> server. Grizzly provides a facility for doing asynchronous reads/writes (via a queue model). It supports TCP and UDP alike. I've used Grizzly in a couple of projects. There are things I like and dislike about the framework, but to detail this is really another topic. I will say that it's quite easy to get something up and running and Grizzly does a lot of the heavy lifting for you.</li> <li><a href="http://www.jboss.org/netty/" rel="noreferrer">Netty</a>. This project comes from one of the original authors on the Mina project. I haven't used this one so I don't know about about its support for asynchronous I/O. You should take a look.</li> </ol> <p>Now, with regard to your question about threads, NIO Selectors do not use threads for non-blocking I/O. In JDK6 they use <strong>select()</strong> under Windows and the epoll facility on newer Linux kernels. For asynchronous I/O, threading details depend on the framework.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload