<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)

    隨筆檔案

    相冊

    搜索

    最新評論

    閱讀排行榜

    主站蜘蛛池模板: 成全视频免费观看在线看| 免费人成又黄又爽的视频在线电影 | 国产在线一区二区综合免费视频| 亚洲美日韩Av中文字幕无码久久久妻妇| 亚洲乱亚洲乱妇无码| 国产美女无遮挡免费视频网站| 亚洲成在人线aⅴ免费毛片| 国产无遮挡裸体免费视频| 国产午夜亚洲精品不卡免下载| 日本免费人成黄页在线观看视频 | 国产自产拍精品视频免费看| 国产偷国产偷亚洲高清人 | 久久久久亚洲精品美女| 午夜视频在线免费观看| 亚洲成在人线中文字幕| 成年女人毛片免费视频| 高清免费久久午夜精品| 国产亚洲人成网站在线观看不卡| 日本免费人成网ww555在线| 亚洲人成在线免费观看| 国产又粗又长又硬免费视频| 中文字幕av免费专区| 亚洲精品国产成人中文| 最近免费中文字幕4| 有码人妻在线免费看片| 亚洲AV无码AV男人的天堂| 美女视频黄a视频全免费| 国产亚洲精品91| 亚洲VA中文字幕无码毛片| 青娱分类视频精品免费2| 综合偷自拍亚洲乱中文字幕| 毛茸茸bbw亚洲人| 国产在线jyzzjyzz免费麻豆| 国产成人久久精品亚洲小说| 亚洲AV午夜成人片| 亚洲精品视频久久| 黄网站色视频免费看无下截| 亚洲乱码一二三四五六区| 国产片免费福利片永久| 免费毛片a线观看| 亚洲免费人成视频观看|