Fix wording in "Universal Asynchronous I/O API" section.

This commit is contained in:
Evan Meagher 2011-10-03 20:32:59 -07:00 committed by Trustin Lee
parent 0d6a5e004d
commit 4ea375362f

View File

@ -84,7 +84,7 @@
<section> <section>
<title>Universal Asynchronous I/O API</title> <title>Universal Asynchronous I/O API</title>
<para> <para>
Traditional I/O APIs in Java provided different types and methods for Traditional I/O APIs in Java provide different types and methods for
different transport types. For example, different transport types. For example,
<classname>java.net.Socket</classname> and <classname>java.net.Socket</classname> and
<classname>java.net.DatagramSocket</classname> do not have any common <classname>java.net.DatagramSocket</classname> do not have any common
@ -93,32 +93,33 @@
</para> </para>
<para> <para>
This mismatch makes porting a network application from one transport to This mismatch makes porting a network application from one transport to
the other tedious and difficult. The lack of portability between another tedious and difficult. The lack of portability between
transports becomes a problem when you need to support more transports not transports becomes a problem when you need to support additional
rewriting the network layer of the application. Logically, many protocols transports, as this often entails rewriting the network layer of the
can run on more than one transport such as TCP/IP, UDP/IP, SCTP, and application. Logically, many protocols can run on more than one
serial port communication. transport such as TCP/IP, UDP/IP, SCTP, and serial port communication.
</para> </para>
<para> <para>
To make the matter worse, Java New I/O (NIO) API introduced the To make matters worse, Java's New I/O (NIO) API introduced
incompatibility with the old blocking I/O (OIO) API, and so will NIO.2 incompatibilities with the old blocking I/O (OIO) API and will continue
(AIO). Because all these APIs are different from each other in design to do so in the next release, NIO.2 (AIO). Because all these APIs are
and performance characteristics, you are often forced to determine which different from each other in design and performance characteristics, you
API your application will depend on before you even begin the are often forced to determine which API your application will depend on
implementation phase. before you even begin the implementation phase.
</para> </para>
<para> <para>
For instance, you might want to start with OIO because the number of For instance, you might want to start with OIO because the number of
clients you are going to serve will be very small and writing a socket clients you are going to serve will be very small and writing a socket
server using OIO is much easier than using NIO. However, you are going server using OIO is much easier than using NIO. However, you are going
to be in trouble when your business grows up exponentially and your server to be in trouble when your business grows exponentially and your server
starts to serve tens of thousand clients simultaneously. You could needs to serve tens of thousands of clients simultaneously. You could
start with NIO, but it might take much longer time to implement due to start with NIO, but doing so may hinder rapid development by greatly
the complexity of the NIO Selector API, hindering rapid development. increasing development time due to the complexity of the NIO Selector
API.
</para> </para>
<para> <para>
Netty has a universal asynchronous I/O interface called &Channel;, which Netty has a universal asynchronous I/O interface called a &Channel;, which
abstracts away all operations required to point-to-point communication. abstracts away all operations required for point-to-point communication.
That is, once you wrote your application on one Netty transport, your That is, once you wrote your application on one Netty transport, your
application can run on other Netty transports. Netty provides a number application can run on other Netty transports. Netty provides a number
of essential transports via one universal API: of essential transports via one universal API:
@ -144,16 +145,15 @@
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
Switching from one transport to the other usually takes just a couple Switching from one transport to another usually takes just a couple
lines of changes such as choosing a different &ChannelFactory; lines of changes such as choosing a different &ChannelFactory;
implementation. implementation.
</para> </para>
<para> <para>
Also, you are even able to take advantage of a new transport which is Also, you are even able to take advantage of new transports which aren't
not written yet, serial port communication transport for instance, again yet written (such as serial port communication transport), again
by replacing just a couple lines of constructor calls. Moreover, you can by replacing just a couple lines of constructor calls. Moreover, you can
write your own transport by extending the core API because it is highly write your own transport by extending the core API.
extensible.
</para> </para>
</section> </section>