学习 Netty 3.x
study link: http://netty.io/3.6/guide/#architecture
应用场景:
Chat server that requires persistent connections and server push technology (e.g. Comet)
Media streaming server that needs to keep the connection open until the whole media is streamed (e.g. 2 hours of video)
File server that allows the uploading of large files without memory pressure (e.g. uploading 1GB per request)
Scalable mash-up client that connects to tens of thousands of 3rd party web services asynchronously
高级特性:
1. Codec (means encode and decode - usually you need to codec the requests from socket stream)
2. SSL (secure socket layer) / TLS (transport layer security) support
3. HTTP easy implementation
4. webSocket support
5. Google Protocol Buffer Integration - binary protocol ?!
powerful architecture. It is composed of three components - buffer, channel, and event model- and all advanced features are built on top of the three core components
Guide:
Request will be read by Channel into ChannelBuffer
Meanwhile it will publish the ChannelEvent to the ChannelHandlers in the ChannelPipeline
ChannelEvent.getChannel()
Response will be generated by ChannelHandlers into ChannelBuffer, lastly write into Channel back to client
* new NioServerSocketChannelFactory( Executors.newCachedThreadPool()
无界线程池,可以进行自动线程回收。
在JDK帮助文档中,有如此一段话: “强烈建议程序员使用较为方便的 Executors 工厂方法 Executors.newCachedThreadPool()(无界线程池,可以进行自动线程回收)、Executors.newFixedThreadPool(int)(固定大小线程池)和 Executors.newSingleThreadExecutor()(单个后台线程),它们均为大多数使用场景预定义了设置。”
More details about ThreadPool tech, you can check http://dongxuan.iteye.com/blog/901689
newFixedThreadPool newSingleThreadExecutor newCachedThreadPool
学习 Netty 3.x的更多相关文章
- Netty学习——Netty和Protobuf的整合(二)
Netty学习——Netty和Protobuf的整合(二) 这程序是有瑕疵的,解码器那里不通用,耦合性太强,有两个很明显的问题,但是要怎么解决呢?如:再加一个内部类型 Person2,之前的代码就不能 ...
- Netty学习——Netty和Protobuf的整合(一)
Netty学习——Netty和Protobuf的整合 Protobuf作为序列化的工具,将序列化后的数据,通过Netty来进行在网络上的传输 1.将proto文件里的java包的位置修改一下,然后再执 ...
- 深入学习Netty(1)——传统BIO编程
前言 之前看过Dubbo源码,Nacos等源码都涉及到了Netty,虽然遇到的时候查查资料,后面自己也有私下学习Netty并实践,但始终没有形成良好的知识体系,Netty对想要在Java开发上不断深入 ...
- 深入学习Netty(2)——传统NIO编程
前言 学习Netty编程,避免不了从了解Java 的NIO编程开始,这样才能通过比较让我们对Netty有更深的了解,才能知道Netty大大的好处.传统的NIO编程code起来比较麻烦,甚至有遗留Bug ...
- 深入学习Netty(3)——传统AIO编程
前言 之前已经整理过了BIO.NIO两种I/O的相关博文,每一种I/O都有其特点,但相对开发而言,肯定是要又高效又简单的I/O编程才是真正需要的,在之前的NIO博文(深入学习Netty(2)--传统N ...
- 深入学习Netty(4)——Netty编程入门
前言 从学习过BIO.NIO.AIO编程之后,就能很清楚Netty编程的优势,为什么选择Netty,而不是传统的NIO编程.本片博文是Netty的一个入门级别的教程,同时结合时序图与源码分析,以便对N ...
- 深入学习Netty(5)——Netty是如何解决TCP粘包/拆包问题的?
前言 学习Netty避免不了要去了解TCP粘包/拆包问题,熟悉各个编解码器是如何解决TCP粘包/拆包问题的,同时需要知道TCP粘包/拆包问题是怎么产生的. 在此博文前,可以先学习了解前几篇博文: 深入 ...
- netty04(重点来了、指定某个客户端发信息或者群发)小声嘀咕~~我也是从零开始学得、、、想学习netty的又不知道怎么下手的童鞋们~~
还是和上几篇一样,先给出前面笔记的连接,有没看的可以去看看再来! netty01 . netty02 .netty03 看到这里.你基本上可以使用netty接受信息和根据对应的信息返回信息了 接 ...
- 【Netty4】深入学习Netty
Netty is an asynchronous event-driven network application framework for rapid development of mainta ...
随机推荐
- mockServer学习
mockServer学习 很喜欢mockserver官方主页的背景颜色和格式 官方主页如下: http://www.mock-server.com/
- java -jar start.jar和nohup java -jar xxx.jar > test.log &的区别
nohup用在什么地方? KD3EE49RD38
- codesmith的使用
新建一个C#模版. model类的模版代码如下: <%-- Name: 模型层代码生成模版 Author: XX Description: 根据数据库的内容生成模型层代码 Version: V1 ...
- 武汉科技大学ACM:1002: 华科版C语言程序设计教程(第二版)例题6.6
Problem Description 明天就要英语考试了,小明明正在挑灯夜 战背单词.小明明发现单词很难背,背一个忘一个.经过仔细研究,小明明发现单词难背的原因是因为某个字符的出现,破坏了整个单词的 ...
- 思科27亿美元收购网络安全公司Sourcefire
据国外媒体报道,思科于今日宣布将以27亿美元的总价收购网络安全公司Sourcefire,以加强自身在网络安全业务领域的优势,该交易将于今年下半年完成. [IT商业新闻网讯](记者 张良)7月23日消息 ...
- 数据库触发器new old
数据库触发器new old: "NEW . column_name"或者"OLD . column_name".这样在技术上处理(NEW | OLD . col ...
- nodejs远程获取图片
if(require("http")) { var http = require("http"); http.g ...
- 转载:执行脚本出现bin/bash: bad interpreter: No such file or directory
转载网址:http://blog.csdn.net/red10057/article/details/8051650 刚刚学习 SHELL 写了一个简单的例子 发生如下错误 -bash: ./test ...
- 《javascript权威指南》读书笔记 -part2
我真的很佩服副院长~他是一个很有耐心 极其细致的人 工作态度严谨 代码简洁风格统一~再乱遭遭的代码只要经过他的手就会变的很漂亮 羡煞我也~ 不说废话了 还是乖乖看书吧~maybe可能也许的某一天 ...
- nginx_笔记分享_配置篇
参考http://www.howtocn.org/nginx:directiveindexhttp://blog.s135.com/ nginx 配置文档为 nginx.conf 比如我的配置文档 / ...