随笔分类 - netty
摘要:入口ByteBuffer.allocateDirect public static ByteBuffer allocateDirect(int capacity) { return new DirectByteBuffer(capacity); } DirectByteBuffer构造函数 Dire
阅读全文
摘要:我们常说的代理也就是只正向代理,正向代理的过程,它隐藏了真实的请求客户端,服务端不知道真实的客户端是谁,客户端请求的服务都 被代理服务器代替来请求,某些科学上网工具扮演的就是典型的正向代理角色。用浏览器访问 google.com 时,被残忍的block,于是你可 以在国外搭建一台代理服务器,让代理帮
阅读全文
摘要:State management 1.业务状态管理-是否登录 A ChannelHandler often needs to store some stateful information. The simplest and recommended approach is to use member
阅读全文
摘要:Future and Promise are the two separate sides of an asynchronous operation. promise is used by the "producer/writer" of the asynchronous operation. fu
阅读全文
摘要:1: Netty 4的线程模型转变 在Netty 3的时候,upstream是在IO线程里执行的,而downstream是在业务线程里执行的。比如netty从网络读取一个包传递给你的handler的时候, 你的handler部分的代码是执行在IO线程里,而你的业务线程调用write向网络写出一些东西
阅读全文
摘要:一、基本类原子操作 AtomicBoolean,AtomicInteger,AtomicLong,AtomicReference<V>对boolean,Integer,long,reference定义的变量进行原子性的操作, 简单点说就是它提供的方法都是原子性的,不会出现线程之间存在的问题 二、原子
阅读全文
摘要:A buffer is a linear, finite sequence of elements of a specific primitive type. Aside from its content, the essential properties of a buffer are its c
阅读全文