What's Mina ?
It provides an abstract · event-driven · asynchronous API over various transports such as TCP/IP and UDP/IP via Java NIO.
If No Mina ?
1) Read, Write, Accept are all in single thread, not flexible for multiply core
2) Read and Business process is binded together. IO/Business layer is fixed
3) ByteBuffer writeBuf -> List<ByteBuffer> writeBuf. There are a lot of write request.
4) If the response is generated in asynchronized way, need an api to add response
add(SocketChannel sc, byte[] response)
Sever Side
Client Side
If No Mina
1) Business process and IO process is separated
2) public void send(SocketChannel socket, byte[] data) should belong to a Session(SocketChannel delegate) rather than NIOServer(ServerSocketChannel delegate)
3) Executor and IO(Read/Write) module is fixed
http://rox-xmlrpc.sourceforge.net/niotut/
Server
Worker
Client
If Mina ?
The background of Mina
The sequence diagram of Mina