<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 閱讀(123) 評論(0)  編輯  收藏


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


    網站導航:
     

    My Links

    News

    留言簿(18)

    隨筆檔案

    相冊

    搜索

    最新評論

    閱讀排行榜

    主站蜘蛛池模板: 亚洲免费黄色网址| 国产亚洲精品成人AA片新蒲金 | xvideos亚洲永久网址| 亚洲日本VA午夜在线电影| 国产成人免费网站| 亚洲精品91在线| 五月婷婷综合免费| 四虎必出精品亚洲高清| 成人男女网18免费视频| 亚洲爆乳无码精品AAA片蜜桃| 国产高清免费的视频| 亚洲AV永久无码精品网站在线观看| 成人五级毛片免费播放| 国产精品亚洲AV三区| 亚洲一区日韩高清中文字幕亚洲| www永久免费视频| 无码乱人伦一区二区亚洲| 国产精彩免费视频| 亚洲精品无码国产片| 免费国产成人高清视频网站| 成人一级免费视频| 亚洲av无码无在线观看红杏| 永久在线观看www免费视频| 亚洲综合欧美色五月俺也去| 啊灬啊灬别停啊灬用力啊免费看| 国产精品九九久久免费视频 | 99热亚洲色精品国产88| 四虎永久免费观看| 黄色网址在线免费| 最新国产精品亚洲| 久久亚洲AV无码西西人体| 免费无码VA一区二区三区| 亚洲午夜精品久久久久久app| 亚洲国模精品一区| 91香蕉国产线在线观看免费| 亚洲乱妇熟女爽到高潮的片| 相泽亚洲一区中文字幕| 九九精品免费视频| 成人网站免费大全日韩国产| 亚洲伦理一二三四| 亚洲人成色777777在线观看|