本文整理汇总了Java中java.beans.Introspector.flushCaches方法的典型用法代码示例。如果您正苦于以下问题:Java Introspector.flushCaches方法的具体用法?Java Introspector.flushCaches怎么用?Java Introspector.flushCaches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.Introspector
的用法示例。
在下文中一共展示了Introspector.flushCaches方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import java.beans.Introspector; //导入方法依赖的package包/类
public void run() {
Introspector.flushCaches();
test(FirstBean.class, FirstBeanBeanInfo.class);
test(SecondBean.class, null);
test(ThirdBean.class, null);
test(ThirdBeanBeanInfo.class, ThirdBeanBeanInfo.class);
Introspector.setBeanInfoSearchPath(SEARCH_PATH);
Introspector.flushCaches();
test(FirstBean.class, FirstBeanBeanInfo.class);
test(SecondBean.class, SecondBeanBeanInfo.class);
test(ThirdBean.class, null);
test(ThirdBeanBeanInfo.class, ThirdBeanBeanInfo.class);
}
示例2: forgetClassLoader
import java.beans.Introspector; //导入方法依赖的package包/类
/**
* Causes the specified classloader to be forgotten, making it and all
* the class definitions loaded by it available for garbage collection
*
* @param id the id of the classloader to forget
*/
public void forgetClassLoader(String id) {
GateClassLoader gcl;
synchronized(childClassLoaders) {
gcl = childClassLoaders.remove(id);
}
if(gcl != null && !gcl.isIsolated()) {
// in theory this shouldn't be needed as the Introspector uses
// soft references if we move to requiring Java 8 it should be
// safe to drop this call
Introspector.flushCaches();
AbstractResource.flushBeanInfoCache();
}
}
示例3: main
import java.beans.Introspector; //导入方法依赖的package包/类
public static void main(String[] args) throws IntrospectionException {
StringBuilder sb = null;
if (args.length > 0) {
if (args[0].equals("show")) {
sb = new StringBuilder(65536);
}
}
Introspector.flushCaches();
int count = (sb != null) ? 10 : 100;
long time = -System.currentTimeMillis();
for (int i = 0; i < count; i++) {
test(sb);
test(sb);
Introspector.flushCaches();
}
time += System.currentTimeMillis();
System.out.println("Time (average): " + time / count);
}
示例4: test
import java.beans.Introspector; //导入方法依赖的package包/类
private static void test() {
test("Bean", "Bean2", "Bean3", "Bean4");
test("Bean4", "Bean", "Bean2", "Bean3");
test("Bean3", "Bean4", "Bean", "Bean2");
test("Bean2", "Bean3", "Bean4", "Bean");
Introspector.flushCaches();
}
示例5: test
import java.beans.Introspector; //导入方法依赖的package包/类
private static void test(Boolean mark, Class... types) {
for (Class type : types) {
BeanInfo info = getBeanInfo(mark, type);
if (info == null) {
throw new Error("could not find BeanInfo for " + type);
}
if (mark != info.getBeanDescriptor().getValue("test")) {
throw new Error("could not find marked BeanInfo for " + type);
}
}
Introspector.flushCaches();
}
示例6: test4168475
import java.beans.Introspector; //导入方法依赖的package包/类
/**
* This is a regression test to ensure that 4168475 does not regress.
*/
private static void test4168475(Class type) {
String[] newPath = {"infos"};
String[] oldPath = Introspector.getBeanInfoSearchPath();
Introspector.setBeanInfoSearchPath(newPath);
BeanInfo info = getBeanInfo(Boolean.TRUE, type);
Introspector.setBeanInfoSearchPath(oldPath);
PropertyDescriptor[] pds = info.getPropertyDescriptors();
if (pds.length != 1) {
throw new Error("could not find custom BeanInfo for " + type);
}
Introspector.flushCaches();
}
示例7: contextDestroyed
import java.beans.Introspector; //导入方法依赖的package包/类
@Override
public void contextDestroyed(ServletContextEvent event) {
CachedIntrospectionResults.clearClassLoader(Thread.currentThread().getContextClassLoader());
Introspector.flushCaches();
}