org.springframework.web.util.IntrospectorCleanupListener的作用
来源:互联网 发布:免费mv制作软件 编辑:程序博客网 时间:2024/06/04 18:20
spring中提供了一个名为org.springframework.web.util.IntrospectorCleanupListener的监听器。
它主要负责处理由JavaBeans Introspector的使用而引起的缓冲泄露。
spring中对它的描述如下:
它是一个在web应用关闭的时候,清除JavaBeans Introspector的监听器.
在web.xml中注册这个listener.
可以保证在web 应用关闭的时候释放与掉这个web 应用相关的class loader 和由它管理的类.
如果你使用了JavaBeans Introspector来分析应用中的类,
Introspector 缓冲中会保留这些类的引用.结果在你的应用关闭的时候,
这些类以及web 应用相关的class loader没有被垃圾回收.
不幸的是,清除Introspector的唯一方式是刷新整个缓冲.这是因为我们没法判断哪些是属于你的应用的引用.
所以删除被缓冲的introspection会导致把这台电脑上的所有应用的introspection都删掉.
需要注意的是,spring 托管的bean不需要使用这个监听器.
因为spring它自己的introspection所使用的缓冲在分析完一个类之后会被马上从javaBeans Introspector缓冲中清除掉.
应用程序中的类从来不直接使用JavaBeans Introspector.
所以他们一般不会导致内存资源泄露.
但是一些类库和框架往往会产生这个问题.例如:Struts 和Quartz.
单个的内存资源泄漏会导致整个的web应用的类加载器不能进行垃圾回收.
在web应用关闭之后,你会看到此应用的所有静态类资源(例如单例).
这个错误当然不是由这个类自身引起的.
在web.xml中添加:
<!-- 防止内存泄露 --> <listener> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener>
- org.springframework.web.util.IntrospectorCleanupListener的作用
- org.springframework.web.util.IntrospectorCleanupListener作用
- org.springframework.web.util.IntrospectorCleanupListener监听器的作用
- org.springframework.web.util.IntrospectorCleanupListener监听器的作用
- org.springframework.web.util.IntrospectorCleanupListener的用途
- org.springframework.web.util.IntrospectorCleanupListener的用途
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.util.IntrospectorCleanupListener防止内存泄漏
- java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
- 慧鑫系统(一)
- 如何在 Linux 中复制文件到多个目录中
- 《C++ Primer Plus(第六版)》(24)(第十二章 类和动态内存分配 编程题和答案)
- Linux下的atime mtime ctime及如何用touch来修改
- NOSQL数据库基本知识
- org.springframework.web.util.IntrospectorCleanupListener的作用
- java 代理二三事
- 概率的定义与性质
- SQL中的DML、DDL以及DCL是什么?
- PostgreSQL中的数据库实例、模式、用户(角色)、表空间
- 图片加载框架之Glide
- Eclipse Maven "Missing artifact jdk.tools:jdk.tools:jar:1.6"
- 复习复习
- cmake命令学习备忘