posts - 339,  comments - 95,  views - 178万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

随笔分类 -  Netty

Netty 的 inbound 与 outbound, 以及 InboundHandler 的 channelInactive 与 OutboundHandler 的 close
摘要:先看一个例子.有一个简单 Serverpublic class SimpleServer { public static void main(String[] args) throws Exception { EventLoopGroup bossGroup = new NioE... 阅读全文
posted @ 2015-04-14 01:35 ZimZz 阅读(18546) 评论(0) 推荐(0) 编辑
关于 Netty Channel 的 Autoread
摘要:Netty 4 的 Channel 多了一个 autoread 参数, 它的用处是在让 channel 在触发某些事件以后(例如 channelActive, channelReadComplete)以后还会自动调用一次 read(), 代码:DefaultChannelPipeline.java ... 阅读全文
posted @ 2014-11-04 02:16 ZimZz 阅读(6144) 评论(0) 推荐(0) 编辑
HashedWheelTimer 原理
摘要:HashedWheelTimer 是根据Hashed and Hierarchical Timing Wheels: Data Structures for the Efficient Implementation of a Timer Facility这篇论文做出来的.HashedWheelTim... 阅读全文
posted @ 2014-08-21 22:59 ZimZz 阅读(22010) 评论(0) 推荐(3) 编辑
Netty 中 IOException: Connection reset by peer 与 java.nio.channels.ClosedChannelException: null
摘要:最近发现系统中出现了很多 IOException: Connection reset by peer 与 ClosedChannelException: null深入看了看代码, 做了些测试, 发现 Connection reset 会在客户端不知道 channel 被关闭的情况下, 触发了 eve... 阅读全文
posted @ 2014-07-23 22:15 ZimZz 阅读(100134) 评论(3) 推荐(0) 编辑
Netty端口被占用问题
摘要:问题:最近发现Netty项目每次发布的时候Netty在重启时都会报端口被占用的异常, 需要过十几秒左右手动重启一遍, Netty才能恢复正常目前猜测是由于Tomcat_restart的时候Netty执行相关的销毁操作, Channel.close().awaitUninterrupted() 以及 ... 阅读全文
posted @ 2014-04-26 22:29 ZimZz 阅读(10181) 评论(0) 推荐(0) 编辑
Netty writeAndFlush() 流程与异步
摘要:Netty writeAndFlush()方法分为两步, 先 write 再 flush @Override public ChannelFuture writeAndFlush(Object msg, ChannelPromise promise) { DefaultCh... 阅读全文
posted @ 2014-04-15 21:15 ZimZz 阅读(54173) 评论(2) 推荐(4) 编辑
Netty堆积泄露问题
摘要:123 阅读全文
posted @ 2014-03-20 18:12 ZimZz 阅读(489) 评论(0) 推荐(0) 编辑
Netty Message RefCount
摘要:ByteBufis always reference countedTo control the life cycle of aByteBufin a more predictable way, Netty does not rely on the garbage collector anymore but employs an explicit reference counter. Here's the basic rule:When a buffer is allocated, its initial reference count is 1.If the reference co 阅读全文
posted @ 2013-11-25 12:42 ZimZz 阅读(595) 评论(0) 推荐(0) 编辑
Netty Associated -- Channel
摘要:A nexus to a network socket or a component which is capable of I/O operations such as read, write, connect, and bind.一个网络套接字或组件的枢纽, 用来进行 I/O 操作, 例如 read, write, connect, bind.A channel provides a user:一个Channel的提供给用户的东西有:the current state of the channel (e.g. is it open? is it connected?),channel目前的 阅读全文
posted @ 2013-10-20 02:39 ZimZz 阅读(492) 评论(0) 推荐(0) 编辑
Netty Associated -- ChannelPipeline
摘要:A list of ChannelHandlers which handles or intercepts inbound events and outbound operations of a Channel. ChannelPipeline implements an advanced form of the Intercepting Filter pattern to give a user full control over how an event is handled and how the ChannelHandlers in a pipeline interact with e 阅读全文
posted @ 2013-10-20 02:17 ZimZz 阅读(1901) 评论(0) 推荐(0) 编辑
User guide for Netty 4.x
摘要:Table of ContentsPrefaceThe SolutionGetting StartedBefore Getting StartedWriting a Discard ServerLooking into the Received DataWriting an Echo ServerWriting a Time ServerWriting a Time ClientDealing with a Stream-based TransportSpeaking in POJO instead of ByteBufShutting Down Your ApplicationSummary 阅读全文
posted @ 2013-10-18 16:50 ZimZz 阅读(5074) 评论(0) 推荐(0) 编辑
Netty Associated -- ByteBuf
摘要:ByteBufByteBuf是Netty的Server与Client之间通信的数据传输载体.他提供了一个byte数组(byte[])的抽象视图buffer创建我们推荐通过一个Unpooled的帮助方法来创建新的buffer而不是通过调用独立的构造器来创建随机访问索引就像普通的原声字节数组一样, By... 阅读全文
posted @ 2013-10-17 20:49 ZimZz 阅读(11969) 评论(1) 推荐(1) 编辑

点击右上角即可分享
微信分享提示