站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.1.0 API 文档英文版

CachedIntrospectionResults (Spring Framework API 2.1) - Spring Framework 2.1.0 API 文档英文版


The Spring Framework

org.springframework.beans
Class CachedIntrospectionResults

java.lang.Object
  extended by org.springframework.beans.CachedIntrospectionResults

public class CachedIntrospectionResults
extends Object

Internal class that caches JavaBeans PropertyDescriptor information for a Java class. Not intended for direct use by application code.

Necessary for own caching of descriptors within the application's ClassLoader, rather than rely on the JDK's system-wide BeanInfo cache (in order to avoid leaks on ClassLoader shutdown).

Information is cached statically, so we don't need to create new objects of this class for every JavaBean we manipulate. Hence, this class implements the factory design pattern, using a private constructor and a static forClass(Class) factory method to obtain instances.

Since:
05 May 2001
Author:
Rod Johnson, Juergen Hoeller
See Also:
acceptClassLoader(ClassLoader), clearClassLoader(ClassLoader), forClass(Class)

Method Summary
static void acceptClassLoader(ClassLoader classLoader)
          Accept the given ClassLoader as cache-safe, even if its classes would not qualify as cache-safe in this CachedIntrospectionResults class.
static void clearClassLoader(ClassLoader classLoader)
          Clear the introspection cache for the given ClassLoader, removing the introspection results for all classes underneath that ClassLoader, and deregistering the ClassLoader (and any of its children) from the acceptance list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

acceptClassLoader

public static void acceptClassLoader(ClassLoader classLoader)
Accept the given ClassLoader as cache-safe, even if its classes would not qualify as cache-safe in this CachedIntrospectionResults class.

This configuration method is only relevant in scenarios where the Spring classes reside in a 'common' ClassLoader (e.g. the system ClassLoader) whose lifecycle is not coupled to the application. In such a scenario, CachedIntrospectionResults would by default not cache any of the application's classes, since they would create a leak in the common ClassLoader.

Any acceptClassLoader call at application startup should be paired with a clearClassLoader(java.lang.ClassLoader) call at application shutdown.

Parameters:
classLoader - the ClassLoader to accept

clearClassLoader

public static void clearClassLoader(ClassLoader classLoader)
Clear the introspection cache for the given ClassLoader, removing the introspection results for all classes underneath that ClassLoader, and deregistering the ClassLoader (and any of its children) from the acceptance list.

Parameters:
classLoader - the ClassLoader to clear the cache for

The Spring Framework

Copyright © 2002-2007 The Spring Framework.