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

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

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

    afunms

    My Software,My Dream—Forge a more perfect NMS product.

    difference between two classLoaders

    struts里總用到Thread.currentThread().getContextClassLoader()
    而我們一般只用到Class.forName()或Class.getClassLoader()

    所以想知道二者有什么區別,以下是從網上找到的:


    Classloader存在下面問題:
    在一個JVM中可能存在多個ClassLoader,每個ClassLoader擁有自己的NameSpace。
    一個ClassLoader只能擁有一個class對象類型的實例,但是不同的ClassLoader可能
    擁有相同的class對象實例,這時可能產生致命的問題。如ClassLoaderA,裝載了
    類A的類型實例A1,而ClassLoaderB,也裝載了類A的對象實例A2。邏輯上講A1=
    A2,但是由于A1和A2來自于不同的ClassLoader,它們實際上是完全不同的,
    如果A中定義了一個靜態變量c,則c在不同的ClassLoader中的值是不同的。

    Class.getClassLoader() returns the ClassLoader that loaded the class it
    is invoked on.

    Thread.getContextClassLoader() returns the ClassLoader set as the
    context ClassLoader for the Thread it is invoked on, which can be
    different from the ClassLoader that loaded the Thread class itself if
    the Thread's setContextClassLoader(ClassLoader) method has been invoked.
    This can be used to allow the object starting a thread to specify a
    ClassLoader that objects running in the thread should use, but the
    cooperation of some of those objects is required for that to work.


     

    posted on 2007-10-16 17:41 afunms 閱讀(119) 評論(0)  編輯  收藏


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


    網站導航:
     

    My Links

    News

    留言簿(18)

    隨筆檔案

    相冊

    搜索

    最新評論

    閱讀排行榜

    主站蜘蛛池模板: 卡1卡2卡3卡4卡5免费视频| 91热成人精品国产免费| 国产午夜影视大全免费观看| 亚洲一级高清在线中文字幕| 1000部拍拍拍18勿入免费视频软件 | 亚洲精品无码你懂的| 在线看片v免费观看视频777| 亚洲人成电影青青在线播放| 91精品国产免费久久国语蜜臀| 国产大片线上免费观看| 亚洲人和日本人jizz| 卡一卡二卡三在线入口免费| 美女黄网站人色视频免费| 亚洲一区二区高清| 99久久免费国产特黄| 亚洲天天做日日做天天看| 国产精品爱啪在线线免费观看| 亚洲精品乱码久久久久久蜜桃| 久久精品国产亚洲av麻豆色欲 | 精品久久久久久亚洲精品| 黄页网站免费观看| 亚洲国产午夜精品理论片在线播放| a级毛片在线免费看| 亚洲成AV人在线观看天堂无码| 99亚洲乱人伦aⅴ精品| 伊人久久亚洲综合影院| 两性色午夜视频免费播放| 亚洲AV无码国产精品麻豆天美| 色网站在线免费观看| 中文字幕人成人乱码亚洲电影| 久久久久亚洲国产AV麻豆 | 无码国产精品久久一区免费| 国产午夜亚洲精品不卡免下载 | 国产精品亚洲mnbav网站 | 野花香在线视频免费观看大全 | 中文字幕无码亚洲欧洲日韩| 亚洲第一黄色网址| 久久午夜免费鲁丝片| 亚洲av永久无码| 日本亚洲成高清一区二区三区 | 日韩激情无码免费毛片|