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

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

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

    Ordinary hut

    人間一福地,勝似天仙宮
    posts - 61, comments - 50, trackbacks - 0, articles - 1
    增加方式如下:
        <listener>
            
    <listener-class>
                org.springframework.web.util.IntrospectorCleanupListener
            
    </listener-class>
        
    </listener>
    spring的說(shuō)明如下:

    Listener that flushes the JDK's JavaBeans Introspector cache on web app shutdown. Register this listener in your web.xml to guarantee proper release of the web application class loader and its loaded classes.

    If the JavaBeans Introspector has been used to analyze application classes, the system-level Introspector cache will hold a hard reference to those classes. Consequently, those classes and the web application class loader will not be garbage-collected on web app shutdown! This listener performs proper cleanup, to allow for garbage collection to take effect.

    Unfortunately, the only way to clean up the Introspector is to flush the entire cache, as there is no way to specifically determine the application's classes referenced there. This will remove cached introspection results for all other applications in the server too.

    Note that this listener is not necessary when using Spring's beans infrastructure within the application, as Spring's own introspection results cache will immediately flush an analyzed class from the JavaBeans Introspector cache and only hold a cache within the application's own ClassLoader. Although Spring itself does not create JDK Introspector leaks, note that this listener should nevertheless be used in scenarios where the Spring framework classes themselves reside in a 'common' ClassLoader (such as the system ClassLoader). In such a scenario, this listener will properly clean up Spring's introspection cache.

    Application classes hardly ever need to use the JavaBeans Introspector directly, so are normally not the cause of Introspector resource leaks. Rather, many libraries and frameworks do not clean up the Introspector: e.g. Struts and Quartz.

    Note that a single such Introspector leak will cause the entire web app class loader to not get garbage collected! This has the consequence that you will see all the application's static class resources (like singletons) around after web app shutdown, which is not the fault of those classes!

    This listener should be registered as the first one in web.xml, before any application listeners such as Spring's ContextLoaderListener. This allows the listener to take full effect at the right time of the lifecycle.


    其中JavaBeans Introspector是一個(gè)類,位置在Java.bean.Introspector,這個(gè)類的用途是發(fā)現(xiàn)java類是否符合javaBean規(guī)范,也就是這個(gè)類是不是javabean。具體用法可以參照jdk文檔;

    上面的意思就是,如果有的框架或者程序用到了JavaBeans Introspector了,那么就啟用了一個(gè)系統(tǒng)級(jí)別的緩存,這個(gè)緩存會(huì)存放一些曾加載并分析過(guò)的javabean的引用,當(dāng)web服務(wù)器關(guān)閉的時(shí)候,由于這個(gè)緩存中存放著這些javabean的引用,所以垃圾回收器不能對(duì)web容器中的javaBean對(duì)象進(jìn)行回收,導(dǎo)致內(nèi)存越來(lái)越大。

    spring提供的org.springframework.web.util.IntrospectorCleanupListener就解決了這個(gè)問(wèn)題,他會(huì)在web服務(wù)器停止的時(shí)候,清理一下這個(gè)Introspector緩存。使那些javabean能被垃圾回收器正確回收。

    spring不會(huì)出現(xiàn)這種問(wèn)題,因?yàn)閟pring在加載并分析完一個(gè)類之后會(huì)馬上刷新JavaBeans Introspector緩存,這樣就保證了spring不會(huì)出現(xiàn)這種內(nèi)存泄漏的問(wèn)題。

    但是有很多程序和框架在使用了JavaBeans Introspector之后,都沒(méi)有進(jìn)行清理工作,比如quartz、struts;解決辦法很簡(jiǎn)單,就是上面的那個(gè)配置。

    主站蜘蛛池模板: 四虎成人免费观看在线网址| 中文字幕亚洲无线码| 亚洲AV无码专区在线电影成人| 四虎影视精品永久免费| 成人毛片100免费观看| 666精品国产精品亚洲| 尤物永久免费AV无码网站| 高清永久免费观看| 亚洲自国产拍揄拍| 亚洲中文无韩国r级电影| 5555在线播放免费播放| 国产精品亚洲综合网站| 亚洲AV无码一区东京热| 日韩免费毛片视频| 一级成人a毛片免费播放| 国产精品亚洲综合一区在线观看 | 亚洲成AV人在线观看天堂无码| 成人免费一区二区无码视频| 成人性生交大片免费看中文| 中文字幕无码亚洲欧洲日韩| 亚洲欧洲美洲无码精品VA| 精品国产麻豆免费网站| 99在线观看免费视频| 日本特黄特色AAA大片免费| 亚洲二区在线视频| 亚洲AV中文无码乱人伦下载| 国产成人涩涩涩视频在线观看免费 | 最近2019中文字幕mv免费看| 免费精品一区二区三区第35| 午夜亚洲国产精品福利| 亚洲大香伊人蕉在人依线| 亚洲色自偷自拍另类小说| 国产男女猛烈无遮挡免费视频网站 | www.黄色免费网站| 久久精品私人影院免费看| 黄色一级视频免费观看| 亚洲中文精品久久久久久不卡| 久久99国产亚洲精品观看| 伊人久久亚洲综合| 亚洲A丁香五香天堂网| 波多野结衣久久高清免费 |