本文整理匯總了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();
}