Java Code Examples for java.beans.Introspector#flushCaches()
The following examples show how to use
java.beans.Introspector#flushCaches() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestIntrospector.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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); }
Example 2
Source File: TestBeanInfo.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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); }
Example 3
Source File: GateClassLoader.java From gate-core with GNU Lesser General Public License v3.0 | 6 votes |
/** * 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(); } }
Example 4
Source File: TestBeanInfo.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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); }
Example 5
Source File: TestIntrospector.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
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); }
Example 6
Source File: TestIntrospector.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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); }
Example 7
Source File: ClassLoaderUtil.java From tomee with Apache License 2.0 | 5 votes |
/** * Cleans well known class loader leaks in VMs and libraries. There is a lot of bad code out there and this method * will clear up the know problems. This method should only be called when the class loader will no longer be used. * It this method is called two often it can have a serious impact on preformance. */ public static void clearClassLoaderCaches() { clearSunSoftCache(ObjectInputStream.class, "subclassAudits"); clearSunSoftCache(ObjectOutputStream.class, "subclassAudits"); clearSunSoftCache(ObjectStreamClass.class, "localDescs"); clearSunSoftCache(ObjectStreamClass.class, "reflectors"); Introspector.flushCaches(); }
Example 8
Source File: Test4508780.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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(); }
Example 9
Source File: Test4520754.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 10
Source File: Test4520754.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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(); }
Example 11
Source File: Test4508780.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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(); }
Example 12
Source File: Test4508780.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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(); }
Example 13
Source File: Test4520754.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 14
Source File: Test4520754.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 15
Source File: Test4508780.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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(); }
Example 16
Source File: Test4520754.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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(); }
Example 17
Source File: PropertyUtilsBean.java From commons-beanutils with Apache License 2.0 | 5 votes |
/** * Clear any cached property descriptors information for all classes * loaded by any class loaders. This is useful in cases where class * loaders are thrown away to implement class reloading. */ public void clearDescriptors() { descriptorsCache.clear(); mappedDescriptorsCache.clear(); Introspector.flushCaches(); }
Example 18
Source File: Test4520754.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 19
Source File: Test4520754.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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(); }
Example 20
Source File: IntrospectorCleanupListener.java From spring-analysis-note with MIT License | 4 votes |
@Override public void contextDestroyed(ServletContextEvent event) { CachedIntrospectionResults.clearClassLoader(Thread.currentThread().getContextClassLoader()); Introspector.flushCaches(); }