日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Floodlight 在 ChannelPipeline 图

發(fā)布時(shí)間:2023/12/4 编程问答 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Floodlight 在 ChannelPipeline 图 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
我們知道,在Netty架構(gòu),一個(gè)ServerBootstrap用于生成server端的Channel的時(shí)候都須要提供一個(gè)ChannelPipelineFactory類型的參數(shù),用于服務(wù)于建立連接的Channel,流水線處理來(lái)自某個(gè)client的請(qǐng)求。所以這里的?OpenflowPipelineFactory 就是Floodlight 為建立連接的openflow交換機(jī)創(chuàng)建ChannelPipeline。





1.?IdleStateHandler 當(dāng)Channel上沒(méi)有運(yùn)行對(duì)應(yīng)的讀寫(xiě)操作一定時(shí)間的時(shí)候出發(fā)一個(gè) IdleStateEvent 事件; 2.?ReadTimeoutHandler 讀超時(shí)處理; 3.?HandshakeTimeoutHandler 設(shè)置一個(gè)定時(shí)器檢查連接的狀態(tài),握手階段 。 4 .?OFChannelHandler 核心,處理全部的業(yè)務(wù)。
代碼例如以下: public?class?OpenflowPipelineFactory?implements?ChannelPipelineFactory {
????protected?Controller?controller?; ????protected?ThreadPoolExecutor?pipelineExecutor?; ????protected?Timer?timer; ????protected?IdleStateHandler?idleHandler?; ????protected?ReadTimeoutHandler?readTimeoutHandler?; ??? ????public?OpenflowPipelineFactory(Controller controller, ?????????????????????????????????? ThreadPoolExecutor pipelineExecutor) { ????????super?(); ????????this?.controller?= controller; ????????this?.pipelineExecutor?= pipelineExecutor; ????????this?.timer?=?new?HashedWheelTimer(); ????????this?.idleHandler?=?new?IdleStateHandler(?timer, 20, 25, 0); ????????this?.readTimeoutHandler?=?new?ReadTimeoutHandler(timer?, 30); ??? } ? ????@Override ????public?ChannelPipeline getPipeline()?throws?Exception { ??????? OFChannelState state =?new?OFChannelState(); ??????? ??????? ChannelPipeline pipeline = Channels.?pipeline(); ??????? pipeline.addLast(?"ofmessagedecoder"?,?new?OFMessageDecoder()); ??????? pipeline.addLast(?"ofmessageencoder"?,?new?OFMessageEncoder()); ??????? pipeline.addLast(?"idle"?,?idleHandler?); ??????? pipeline.addLast(?"timeout"?,?readTimeoutHandler?); ??????? pipeline.addLast(?"handshaketimeout"?, ?????????????????????????new?HandshakeTimeoutHandler(state,?timer?, 15)); ????????if?(pipelineExecutor?!=?null) ??????????? pipeline.addLast(?"pipelineExecutor"?, ?????????????????????????????new?ExecutionHandler(pipelineExecutor?)); ????????//OFChannelHandler 是核心 ??????? pipeline.addLast(?"handler"?,?controller?.getChannelHandler(state)); ????????return?pipeline; ??? } }



版權(quán)聲明:本文博客原創(chuàng)文章,博客,未經(jīng)同意,不得轉(zhuǎn)載。

總結(jié)

以上是生活随笔為你收集整理的Floodlight 在 ChannelPipeline 图的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。