没有合适的资源?快使用搜索试试~ 我知道了~
首页Mina 2.0 User Guide(Mina 2.0 用户指南)
MINA 2.0 User Guide Part I - Basics Chapter 1 - Getting Started Chapter 2 - Basics Chapter 3 - Service Chapter 4 - Session Chapter 5 - Filters Chapter 6 - Transports Chapter 7 - Handler Part II - MINA Core Chapter 8 - Acceptor Chapter 9 - Connector Chapter 10 - IoBuffer Chapter 11 - Codec Filter Chapter 12 - Executor Filter Chapter 13 - SSL Filter Chapter 14 - Logging Filter Part III - MINA Advanced Chapter 15 - Debugging Chapter 16 - State Machine Chapter 17 - Proxy Chapter 18 - JMX Integration Chapter 19 - Spring Integration
资源详情
资源评论
资源推荐
Chapter 1 - Getting Started
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.
The java.nio.* package contains following key constructs
Buffers - Data Containers
Chartsets - Containers translators for bytes and Unicode
Channels - represents connections to entities capable of I/O operations
Selectors - provide selectable, multiplexed non-blocking IO
MINA is a simple yet full-featured network application framework which provides:
Unified API for various transport types:
o TCP/IP & UDP/IP via Java NIO
o Serial communication (RS232) via RXTX
o In-VM pipe communication
o You can implement your own!
Filter interface as an extension point; similar to Servlet filters
Low-level and high-level API:
o Low-level: uses ByteBuffers
o High-level: uses user-defined message objects and codecs
Highly customizable thread model:
o Single thread
o One thread pool
o 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 managability
Stream-based I/O support via StreamIoHandler
Integration with well known containers such as PicoContainer and Spring
Smooth migration from Netty, an ancestor of Apache MINA.
Download
Download the latest MINA release from Downloads Section
What's inside
After the download is complete, extract the content of tar.gz or zip file to local hard drive. The downloaded
compressed file has following contents
--/mina-2.0.0
|
|- dist
|- docs
|- lib
|- src
|- LICENSE.txt
|- LICENSE.jzlib.txt
|- LICENSE.ognl.txt
|- LICENSE.slf4j.txt
|- LICENSE.springframework.txt
|- NOTICE.txt
Content Details
dist - Contains jars for the MINA library code
docs - Contains API docs and Code xrefs
lib - Contains all needed jars for all the libraries needed for using MINA
Additional to these, the base directory has couple of license and notice files
Running First MINA Program
Well, we have downloaded the release, lets run our first MINA example, shipped with the release.
Put the following jars in the classpath
mina-core-2.0.0.jar
mina-example-2.0.0.jar
slf4j-api-1.5.11.jar
slf4j-log4j12-1.5.0.jar
log4j-1.2.15.jar
Logging Tip
Log4J 1.2 users: slf4j-api.jar, slf4j-log4j12.jar, and Log4J 1.2.x
Log4J 1.3 users: slf4j-api.jar, slf4j-log4j13.jar, and Log4J 1.3.x
java.util.logging users: slf4j-api.jar and slf4j-jdk14.jar
IMPORTANT: Please make sure you are using the right slf4j-*.jar that matches to your logging framework.
For instance, slf4j-log4j12.jar and log4j-1.3.x.jar can not be used together, and will malfunction.
If you don't need a logging framework you can use slf4j-nop.jar for no logging or slf4j-simple.jar for
very basic logging.
On the command prompt, issue the following command :
>java org.apache.mina.example.gettingstarted.timeserver.MinaTimeServer
This shall start the server. Now telnet and see the program in action
Issue following command to telnet
telnet 127.0.0.1 9123
Well, we have run our first MINA program. Please try other sample programs shipped with MINA as examples.
Summary
In this chapter, we looked at MINA based Application Architecture, for Client as well as Server. We also touched
upon the implementation of Sample TCP Server/Client, and UDP Server and Client.
In the chapters to come we shall discuss about MINA Core constructs and advanced topics
Chapter 2 - Basics
In Chapter 1, we had a brief glimpse of Apache MINA. In this chapter we shall have a look at Client/Server
Architecture and details on working out a MINA based Server and Client
Application Architecture Introduction
Well 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
Lets take a deeper dive into the details
The image is from Emmanuel Lécharny presentation MINA in real life (ApacheCon EU 2009)
Broadly, MINA based applications are divided into 3 layers
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
So, how to create a MINA based Application
1. Create I/O service - Choose from already available Services (*Acceptor) or create your own
2. Create Filter Chain - Choose from already existing Filters or create a custom Filter for transforming
request/response
3. Create I/O Handler - Write business logic, on handling different messages
Creating a MINA application is this simple
Server Architecture
We have seen, MINA based Application Architecture in previous section. Lets focus on Server Architecture. A
Server listens on a port for incoming requests, process them and send replies.
Full Size | Edit Diagram | Remove Diagram
IOAcceptor listens on the network for incoming connections/packets
剩余70页未读,继续阅读
ddpie
- 粉丝: 3
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- ExcelVBA中的Range和Cells用法说明.pdf
- 基于单片机的电梯控制模型设计.doc
- 主成分分析和因子分析.pptx
- 共享笔记服务系统论文.doc
- 基于数据治理体系的数据中台实践分享.pptx
- 变压器的铭牌和额定值.pptx
- 计算机网络课程设计报告--用winsock设计Ping应用程序.doc
- 高电压技术课件:第03章 液体和固体介质的电气特性.pdf
- Oracle商务智能精华介绍.pptx
- 基于单片机的输液滴速控制系统设计文档.doc
- dw考试题 5套.pdf
- 学生档案管理系统详细设计说明书.doc
- 操作系统PPT课件.pptx
- 智慧路边停车管理系统方案.pptx
- 【企业内控系列】企业内部控制之人力资源管理控制(17页).doc
- 温度传感器分类与特点.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论14