<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免费放dvd| 亚洲va久久久噜噜噜久久狠狠| 一级毛片不卡免费看老司机| 亚洲中文字幕无码久久2017 | 亚洲av永久中文无码精品 | 无码AV片在线观看免费| 亚洲高清免费在线观看| 日本免费网址大全在线观看| 亚洲爆乳少妇无码激情| 亚洲中文无韩国r级电影| 毛片免费在线观看| 亚洲欧洲日产国码在线观看| 在线免费观看一级片| 免费又黄又爽又猛大片午夜 | 一级中文字幕乱码免费| 亚洲精品美女久久777777| 免费精品无码AV片在线观看| 狠狠色香婷婷久久亚洲精品| 亚洲国产成人久久综合一区77| 国产午夜成人免费看片无遮挡| 亚洲精品国产啊女成拍色拍| 日本无吗免费一二区| 精品一区二区三区免费观看| 久久久无码精品亚洲日韩按摩| 大香人蕉免费视频75| a高清免费毛片久久| 亚洲成在人线中文字幕| 免费在线观看中文字幕| 久久久久久AV无码免费网站下载| 亚洲午夜一区二区三区| 久久亚洲色一区二区三区| 亚洲黄色免费观看| 人妻仑刮八A级毛片免费看| 久久久无码精品亚洲日韩京东传媒| 四色在线精品免费观看| 最近中文字幕大全免费版在线| 亚洲AV成人一区二区三区在线看|