apache mina 2.x
Posted by groovy on 10월 14, 2011
3-layer
- I/O Service - Performs actual I/O
- I/O Filter Chain - Filters/Transforms bytes into desired Data Structures and vice-versa
- I/O Handler - Here resides the actual business logic
create mina application process
- Create I/O service - Choose from already available Services (*Acceptor) or create your own
- Create Filter Chain - Choose from already existing Filters or create a custom Filter for transforming request/response
- Create I/O Handler - Write business logic, on handling different messages
Creating a MINA application is this simple
- Server - IoAcceptor implement
- client -IoConnector implement
Session
client 가 server 에 접속시 생성되며, disconected 하기전까지 메모리에 상주한다.
- Connected : the session has been created and is available
- Idle : the session hasn’t processed any request for at least a period of time (this period is configurable)
- Idle for read : no read has actually been made for a period of time
- Idle for write : no write has actually been made for a period of time
- Idle for both : no read nor write for a period of time
- Closing : the session is being closed (the remaining messages are being flushed, cleaning up is not terminated)
- Closed : The session is now closed, nothing else can be done to revive it.
IOBuffer
- Buffers are just buffers
- ByteBuffer의 wrapper 객체인 IOBuffer는 3.x에 대폭 수정되거나, deprecated 될것으로 보여진다.
- Assuming that the MINA ByteBuffer is just a wrapper on top of NIO ByteBuffer, this can be a real problem when using direct buffers.