You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2012/10/16 18:15:20 UTC
svn commit: r1398870 -
/mina/site/trunk/content/mina/userguide/ch1/nio_overview.mdtext
Author: elecharny
Date: Tue Oct 16 16:15:20 2012
New Revision: 1398870
URL: http://svn.apache.org/viewvc?rev=1398870&view=rev
Log:
Added some content in the NIO overview page
Modified:
mina/site/trunk/content/mina/userguide/ch1/nio_overview.mdtext
Modified: mina/site/trunk/content/mina/userguide/ch1/nio_overview.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina/userguide/ch1/nio_overview.mdtext?rev=1398870&r1=1398869&r2=1398870&view=diff
==============================================================================
--- mina/site/trunk/content/mina/userguide/ch1/nio_overview.mdtext (original)
+++ mina/site/trunk/content/mina/userguide/ch1/nio_overview.mdtext Tue Oct 16 16:15:20 2012
@@ -18,7 +18,39 @@ Notice: Licensed to the Apache Softwa
# NIO Overview
-**NIO** _API_'s were introduced in **Java 1.4** and had since been used for wide number of applications. **NIO** _API_'s allows **IO** operations without blocking the processing with it.
+**NIO** _API_'s were introduced in **Java 1.4** and had since been used for wide number of applications. **NIO** _API_'s allows **IO** non-blocking operations.
+
+<DIV class="panelMacro">
+ <TABLE class="noteMacro">
+ <COLGROUP>
+ <COL width="24"><COL>
+ </COLGROUP>
+ <TR>
+ <TD valign="top">
+ <IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0">
+ </TD>
+ <TD>
+ First of all, it's good to know that **MINA** is written on top of **NIO 1**. A new version has been designed in **Java 7**, **NIO-2**, we don't yet benefit from the added features this version is carrying.
+ </TD>
+ </TR>
+ </TABLE>
+</DIV>
+
+<DIV class="panelMacro">
+ <TABLE class="noteMacro">
+ <COLGROUP>
+ <COL width="24"><COL>
+ </COLGROUP>
+ <TR>
+ <TD valign="top">
+ <IMG src="../../../staticResources/icons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0">
+ </TD>
+ <TD>
+ It's also important to know that the **N** in **NIO** means **New**, but we will use the **Non-Blocking** term in many places. **NIO-2** should be seen as a **New** **New** **I/O...
+ </TD>
+ </TR>
+ </TABLE>
+</DIV>
The `java.nio.*` package contains following key constructs
@@ -26,5 +58,17 @@ The `java.nio.*` package contains follow
* _Chartsets_ - Containers translators for bytes and Unicode
* _Channels_ - represents connections to entities capable of I/O operations
* _Selectors_ - provide selectable, multiplexed non-blocking IO
+* _Regexps_ - provide provide some tools to manipulate regular expressions
+
+We are mostly interested in the _Channels_, _ Selectors_ and _Buffers_ parts in the **MINA** framework. This user guide will thus focus on those parts.
+
+# NIO vs BIO
+
+It's important to understand the difference between those two APIs. **BIO**, or **Blocking** **IO**, relies on plain sockets used in a blocking mode : when you read, write or do whatever operation on a socket, the called operation will blcok the caller until the operation is completed.
+
+In some cases, it's critical to be able to call the operation, and to expect the called operation to inform the caller when the operation is done : the caller can then do something else in the mean time.
+
+This is also where **NIO** offers a better way to handle **IO** when you have numerous connected sockets : you dn't have to create a specific thread for each connection, you can just use a few threads to do the same job.
+If you want to get more information about what covers **NIO**, there is a lot of good articles around the web, and a few books cobering this matter.