<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毛片免费播放嗯啊| 国产VA免费精品高清在线| 国产h肉在线视频免费观看| 久久精品国产亚洲av麻豆| 中文字幕在线免费视频| 亚洲人成未满十八禁网站| 国产精品小视频免费无限app | 亚洲欧洲自拍拍偷综合| 亚洲国产精品自在自线观看| 国产又黄又爽胸又大免费视频| 久久精品国产亚洲Aⅴ香蕉| 亚洲同性男gay网站在线观看| 一级特黄aaa大片免费看| 国产亚洲精品免费视频播放| a级毛片黄免费a级毛片| 亚洲视频在线不卡| 亚洲AV成人精品一区二区三区| 国产一区视频在线免费观看| 美女隐私免费视频看| 一个人免费观看在线视频www | 国产成人精品日本亚洲网站| 亚洲中文无码亚洲人成影院| 午夜爱爱免费视频| 草久免费在线观看网站| 日韩电影免费在线观看视频| 国产亚洲精品欧洲在线观看| 成年丰满熟妇午夜免费视频| 美女免费视频一区二区| 亚洲阿v天堂在线| 国产又大又粗又长免费视频| 亚洲AV无码成人专区片在线观看| 每天更新的免费av片在线观看| 亚洲熟妇丰满多毛XXXX| 99久久精品国产免费| 亚洲s码欧洲m码吹潮| 亚洲自偷自偷图片| 九九99热免费最新版| 国产免费看插插插视频| 久久免费美女视频| 亚洲日韩中文无码久久| 一二三四免费观看在线电影 |