IntrospectorCleanupListener
来源:互联网 发布:linux部署javaweb项目 编辑:程序博客网 时间:2024/05/19 22:02
JavaBeans Introspector是一个类,位置在Java.bean.Introspector,这个类的用途是发现java类是否符合javaBean规范,也就是这个类是不是javabean。具体用法可以参照jdk文档;
上面的意思就是,如果有的框架或者程序用到了JavaBeans Introspector了,那么就启用了一个系统级别的缓存,这个缓存会存放一些曾加载并分析过的javabean的引用,当web服务器关闭的时候,由于这个缓存中存放着这些javabean的引用,所以垃圾回收器不能对web容器中的javaBean对象进行回收,导致内存越来越大。
spring提供的org.springframework.web.util.IntrospectorCleanupListener就解决了这个问题,他会在web服务器停止的时候,清理一下这个Introspector缓存。使那些javabean能被垃圾回收器正确回收。
spring不会出现这种问题,因为spring在加载并分析完一个类之后会马上刷新JavaBeans Introspector缓存,这样就保证了spring不会出现这种内存泄漏的问题。
但是有很多程序和框架在使用了JavaBeans Introspector之后,都没有进行清理工作,比如quartz、struts;解决办法很简单,就是上面的那个配置。
- 用法很简单,就是在web.xml中加入:
- <listener>
- <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
- </listener>
0 0
- IntrospectorCleanupListener
- IntrospectorCleanupListener
- IntrospectorCleanupListener
- IntrospectorCleanupListener
- IntrospectorCleanupListener类
- IntrospectorCleanupListener 简介
- IntrospectorCleanupListener类
- IntrospectorCleanupListener介绍
- IntrospectorCleanupListener 简介
- 04、IntrospectorCleanupListener
- IntrospectorCleanupListener 监听器
- IntrospectorCleanupListener 简介
- IntrospectorCleanupListener 简介
- IntrospectorCleanupListener作用
- IntrospectorCleanupListener作用
- IntrospectorCleanupListener作用
- IntrospectorCleanupListener作用
- IntrospectorCleanupListener作用
- XMLHttpRequest Level 2 使用指南
- 《程序员的思维修炼》读后感
- Vue.js:轻量高效的前端组件化方案
- 用Orca查看MSI安装包的Product Code
- 软件文档
- IntrospectorCleanupListener
- oracle修改密码,以及密码过期
- 安装用于学习C语言的linux系统基本步骤
- 是什么卡住了大数据的应用?
- Collection 和 Map 遍历过程的区别
- WebView捕获用户输入的信息
- iOS 检测内存泄漏Analyze出现的一些问题
- 如何学习开源项目及Ceph的浅析
- php中Session使用方法详解