7026287: Implement New I/O API (NIO.2) demo/sample

Alan Bateman Alan.Bateman at oracle.com
Mon Apr 11 06:14:13 PDT 2011


Rickard Bäckman wrote:
> Some sample code implementing a pretty basic chat server using the new 
> asynchronous APIs in JDK7.
>
> The suggested sample: 
> http://cr.openjdk.java.net/~rbackman/7026287/7026287-1/webrev/ 
> <http://cr.openjdk.java.net/%7Erbackman/7026287/7026287-1/webrev/>
>
> Thanks
> /Rickard
Thanks for creating an additional sample for us. I've sent comments 
off-list on previous iterations so the following are just a few final 
comments.

It might be better to put this sample in a "charserver" directory as 
it's very possible that we'll add additional sample code for the 
asynchronous I/O API in the future.

In the top-level Makefile it's probably best to keep the SUBDIRS list in 
alphabetical order, not strictly required of course.

The copyright date on make/mksample/nio/aio/Makefile is 2008-2011 and I 
assume you mean only 2011.

In the README.txt I think this we should change this statement:
"The server was written to demonstrate parts of the new functionality in 
NIO.2, in particular the asynchronous socket parts."
to
"The server was written to demonstrate the asynchronous I/O API in JDK 
7. The sample assumes the reader has some familiarity with the subject 
matter."

In ChatTest you should be able to use the @library tag to avoid listing 
the relative path to each class, eg:

 * @library ../../../../src/share/sample/nio/aio
 * @build ChatTest ChatServer Client ...
 * @run main ChatTest

That's all I have.

-Alan.



More information about the nio-dev mailing list