1.首先,了解下mina框架有哪些特点,适合什么样的场景
MINA is a simple yet full-featurednetwork application framework which provides:
//可以支持各种协议,包括自己的协议
- Unified API for various transport types:
- TCP/IP & UDP/IP via Java NIO
- Serial communication (RS232) via RXTX
- In-VM pipe communication
- You can implement your own!
//提供滤波器接口
- Filter interface as an extension point; similar to Servlet filters
//可以调用不同类型的API,低层次的有ByteBuffer,高层次的有用户自己定义消息对象
- Low-level and high-level API:
- Low-level: uses ByteBuffers
- High-level: uses user-defined message objects and codecs
//非常个性化的线程订制,可以提供单线程,单线程池,多线程池
- Highly customizable thread model:
- Single thread
- One thread pool
- More than one thread pools (i.e. SEDA)
- Out-of-the-box SSL · TLS · StartTLS support using Java 5 SSLEngine
- Overload shielding & traffic throttling
- Unit testability using mock objects
- JMX manageability
//支持对象流
- Stream-based I/O support via StreamIoHandler
- Integration with well known containers such as PicoContainer and Spring
//很容易从Netty移植到mina
- Smooth migration from Netty, an ancestor of Apache MINA.
2.分析mina框架结构和原理
MINA based Application Architecture
It's the question most asked : 'How does a MINA based application look like'? In this article lets see what's the architecture of MINA based application. Have tried to gather the information from presentations based on MINA.
A Bird's Eye View :

Here, we can see that MINA is the glue between your application (be it a client or a server) and the underlying network layer, which can be based on TCP, UDP, in-VM comunication or even a RS-232C serial protocol for a client.
You just have to design your application on top of MINA without having to handle all the complexity of the newtork layer.

Apache MINA是一个网络应用框架,提供统一的API处理多种传输类型,如TCP/IP、UDP/IP等。其核心特性包括过滤器接口、低层次和高层次API以及高度定制的线程模型。MINA应用程序由I/O服务、I/O过滤器链和I/O处理器组成,简化了网络层的复杂性。开发者需要创建I/O服务、过滤器链和处理器来构建基于MINA的应用。
最低0.47元/天 解锁文章
8万+

被折叠的 条评论
为什么被折叠?



