<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    云自無心水自閑

    天平山上白云泉,云自無心水自閑。何必奔沖山下去,更添波浪向人間!
    posts - 288, comments - 524, trackbacks - 0, articles - 6
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    Netty insight

    Posted on 2014-11-21 14:18 云自無心水自閑 閱讀(532) 評論(0)  編輯  收藏
    Netty
    1. there're 2 EventLoopGroup in netty, bossGroup and workerGroup, (1 implementation NioEventLoopGroup is a kind of thread pool)
    2. bossGroup is Acceptor,is responsible for creating Channels for incoming connection requests
    3. workerGroup is the Reactor/Selector?, handling I/O requests. 
    4. a thread in bossGroup will be listening in the port, Once a connection has been accepted workerGroup assigns an EventLoop to its Channel
    5. multiple channels can be registered into 1 EventLoop, multiple EventLoops will exist in workerGroup
    6. workerGroup will iterate all the EventLoop, and iterate all the channels in EventLoop, if any of the channel is ready to execute/process
    7. it will invoke all the channelHandlers in the channelPipeline
    8. ChannelPipelines are containers for chains of ChannelHandlers which executed in order
    9. There are, in fact, two ways of sending messages in Netty. You can write directly to the Channel or write to the ChannelHandlerContext object. The main difference is that the former approach causes the message to start from the tail of the ChannelPipeline, while the latter causes the message to start from the next handler in the ChannelPipeline.
    10. While the I/O thread must not be blocked at all, thus prohibiting any direct blocking operations within your ChannelHandler, there is a way to implement this requirement.
    You can specify an EventExecutorGroup when adding ChannelHandlers to the ChannelPipeline.
    This EventExecutorGroup will then be used to obtain an EventExecutor, which will execute all the methods of the ChannelHandler.
    This EventExecutor will use a different thread from the I/O thread, thus freeing up the EventLoop.

    Channel ch = ...;
    ChannelPipeline p = ch.pipeline();
    EventExecutor e1 = new DefaultEventExecutor(16);
    EventExecutor e2 = new DefaultEventExecutor(8);
     
    p.addLast(new MyProtocolCodec());
    p.addLast(e1, new MyDatabaseAccessingHandler());
    p.addLast(e2, new MyHardDiskAccessingHandler());

    http://stackoverflow.com/questions/12928723/netty-4-eventloopgroup-eventloop-eventexecutor-thread-affinity



    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 国产1000部成人免费视频| 一级毛片aa高清免费观看| 16女性下面无遮挡免费| 亚洲国产美女精品久久久久∴| 噜噜噜亚洲色成人网站| 在线永久免费观看黄网站| 亚洲国产视频久久| 成人一a毛片免费视频| 亚洲日韩亚洲另类激情文学| 免费黄色小视频网站| 亚洲av色香蕉一区二区三区| 日韩特黄特色大片免费视频| 激情小说亚洲图片| 亚洲国产天堂久久久久久| 国产一二三四区乱码免费| 亚洲AV永久青草无码精品| 91高清免费国产自产| 亚洲 日韩经典 中文字幕| 国产日产成人免费视频在线观看| 国产亚洲精品欧洲在线观看| 亚洲精品久久久www| 任你躁在线精品免费| 精品无码一区二区三区亚洲桃色| 日本h在线精品免费观看| 亚洲人成网站免费播放| 亚洲男人在线无码视频| 久久国产精品免费网站| 亚洲AV无码专区在线亚| 亚洲精品国产福利一二区| 精品四虎免费观看国产高清午夜 | 高清免费久久午夜精品| 亚洲人精品午夜射精日韩 | 成人午夜免费福利| 无遮挡呻吟娇喘视频免费播放| 亚洲色欲色欲www在线丝| 免费A级毛片无码无遮挡内射| 七次郎成人免费线路视频 | 国产精品亚洲аv无码播放| 免费精品国产自产拍在线观看图片| 国产亚洲Av综合人人澡精品| 久久精品国产亚洲av成人|