JMX

          jmx architecture

          instrumentation level   設(shè)備層
          agent level  代理層
          distributed level 分發(fā)層

          圖:1


          instrumentation level:
          jmx定義了instrumentation level如何去定義資源以被管理。
          實現(xiàn)了instrumentation的接口稱為managed bean 或MBean.

          定義MBean:
          1.實現(xiàn)MBean interface
          2.實現(xiàn)DynamicMBean

          實現(xiàn)自己MBean接口的類稱為標(biāo)準(zhǔn)MBean(standard MBean)
          Standard MBean可以通過屬性、方法修改其內(nèi)容。
          屬性通過get,set方法。

          MBean interface:
          Mbean interafce為 類名+MBean,如MyClass,其MBean定義為MyClassMBean

          DynamicMBean interface:
          getMBeanInfo(): MBeanInfo
          getAttribute( attribute:String ): Object
          getAttributes( attributes:String[] ): AttributeList
          setAttribute( attribute:Attribute ): void
          setAttributes( attributes:AttributeList ): AttributeList
          invoke( actionName:String,params:Object[],signature:String[] ): Object


          Standard MBean 繼承模式:
          B類無MBean,通過繼承A類得到AMBean的接口。

          B類有MBean接口,則通過繼承A,也無法得到AMBean的接口
          (以下待測試,B既實現(xiàn)了BMbean接口,又繼承A類)
          AMBean <- BMBean
          A <- B
          則B只繼承BMBean的內(nèi)容,對AMBean無關(guān)系

          DynamicMBean 繼承模式類似Standard MBean,通過繼承A類得到getters/setters接口。


          實踐:
          1.下載demo,javac編譯后運行
          2.打開jconsole,打開MBean窗口,可以進(jìn)行參數(shù)調(diào)用,屬性修改。

          notification:

          javax.management.AttributeChangeNotification[source=com.example.mbeans:type=Hello][type=jmx.attribute.change][message=CacheSize changed]

           


           資料:
          1.JMX_1_4_specification.pdf
          2.jmx doc tutorial
          3. Java Dynamic Management Kit 5.1 Tutorial:http://docs.sun.com/app/docs/doc/816-7609

          posted on 2009-12-24 10:56 江永源blog 閱讀(155) 評論(0)  編輯  收藏


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


          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

          常用鏈接

          隨筆檔案(1)

          文章分類(1)

          文章檔案(9)

          最新隨筆

          積分與排名

          最新評論

          主站蜘蛛池模板: 星子县| 蒙城县| 开平市| 久治县| 阳江市| 九江县| 台前县| 石泉县| 金门县| 措美县| 旅游| 荃湾区| 乌兰察布市| 山阴县| 威海市| 潍坊市| 朝阳市| 五寨县| 谢通门县| 鲁山县| 常熟市| 拉孜县| 闽侯县| 昭苏县| 西林县| 沙田区| 醴陵市| 迁安市| 怀集县| 昌吉市| 宁安市| 射阳县| 平潭县| 清远市| 北海市| 增城市| 富顺县| 安宁市| 德钦县| 保靖县| 浦县|