Example usage for java.beans Introspector flushCaches

List of usage examples for java.beans Introspector flushCaches

Introduction

In this page you can find the example usage for java.beans Introspector flushCaches.

Prototype

public static void flushCaches() 

Source Link

Document

Flush all of the Introspector's internal caches.

Usage

From source file:com.codebase.foundation.classloader.xbean.ClassLoaderUtil.java

/**
 * 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 known 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.
 * @param classLoader the class loader to destroy
 *//*w  w  w. ja va 2  s  .co m*/
public static void destroy(ClassLoader classLoader) {
    releaseCommonsLoggingCache(classLoader);
    clearSunSoftCache(ObjectInputStream.class, "subclassAudits");
    clearSunSoftCache(ObjectOutputStream.class, "subclassAudits");
    clearSunSoftCache(ObjectStreamClass.class, "localDescs");
    clearSunSoftCache(ObjectStreamClass.class, "reflectors");
    Introspector.flushCaches();
}

From source file:com.revolsys.ui.web.servlet.WebUIServletContextListener.java

@Override
public final void contextDestroyed(final ServletContextEvent event) {
    final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    LogFactory.releaseAll();//from  w w w  .  ja v a  2  s . c om
    Introspector.flushCaches();
}

From source file:com.wavemaker.runtime.server.CleanupListener.java

@Override
public void contextDestroyed(ServletContextEvent event) {
    try {/*from w  ww .j  a va  2  s  .  c  o m*/
        // remove from the system DriverManager the JDBC drivers registered
        // by this web app
        for (Enumeration<Driver> e = CastUtils.cast(DriverManager.getDrivers()); e.hasMoreElements();) {
            Driver driver = e.nextElement();
            if (driver.getClass().getClassLoader() == getClass().getClassLoader()) {
                DriverManager.deregisterDriver(driver);
            }
        }

        LogFactory.releaseAll();

        // flush all of the Introspector's internal caches
        Introspector.flushCaches();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:hotbeans.support.SpringHotBeanContext.java

/**
 * Destroys this context.//w  w  w . ja  va2  s  . c o  m
 */
public void destroy() {
    if (this.initialized) {
        super.destroy();

        LogFactory.release(this.classLoader);

        Introspector.flushCaches();

        this.initialized = false;
    }

    this.classLoader = null;
}

From source file:com.atlassian.jira.web.dispatcher.JiraWebworkActionDispatcher.java

/**
 * Initialize dispatcher servlet/*  w  w w.  ja  v a 2  s .  c om*/
 *
 * @param config ServletConfig
 */
public void init(ServletConfig config) throws ServletException {
    super.init(config);

    if (JiraStartupChecklist.startupOK()) {
        // Clear caches
        // RO: If not, then it will contain garbage after a couple of redeployments
        Introspector.flushCaches();

        // Clear ValueStack method cache
        // RO: If not, then it will contain garbage after a couple of redeployments
        ValueStack.clearMethods();

        // Find the save dir, which should be the servlet context temp directory
        // Use the default - the Servlet Context Temp Directory.
        File tempdir = (File) config.getServletContext().getAttribute("javax.servlet.context.tempdir");
        if (tempdir != null) {
            saveDir = tempdir.getAbsolutePath();
        } else {
            log.error("Servlet Context Temp Directory isn't set. No save directory set for file uploads.");
        }
        log.info("Setting Upload File Directory to '{}'", saveDir);
        log.info("JiraWebworkActionDispatcher initialized");
    } else {
        // JIRA startup not OK
        String message = "JIRA startup failed, JIRA has been locked.";
        String line = StringUtils.repeat("*", message.length());
        log.error(NEW_LINE + NEW_LINE + line + NEW_LINE + message + NEW_LINE + line + NEW_LINE);
    }
}

From source file:com.liferay.portal.spring.extender.internal.context.ModuleApplicationContextRegistrator.java

private void _cleanInstropectionCaches(Bundle bundle) {
    BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);

    CachedIntrospectionResults.clearClassLoader(bundleWiring.getClassLoader());

    Introspector.flushCaches();
}

From source file:org.red5.server.jboss.JbossLoader.java

/**
 * Shut server down/*  ww  w . j a v a 2s .  c om*/
 */
public void stop() {
    logger.info("Shutting down jboss context");
    try {
        //prepare spring for shutdown
        Introspector.flushCaches();
        //shutdown our jmx agent
        JMXAgent.shutdown();
        //shutdown spring
        FileSystemXmlApplicationContext appContext = (FileSystemXmlApplicationContext) getApplicationContext();
        ConfigurableBeanFactory factory = appContext.getBeanFactory();
        if (factory.containsSingleton("default.context")) {
            for (String scope : factory.getRegisteredScopeNames()) {
                logger.debug("Registered scope: " + scope);
            }
            for (String singleton : factory.getSingletonNames()) {
                logger.debug("Registered singleton: " + singleton);
                //factory.destroyScopedBean(singleton);
            }
            factory.destroySingletons();
        }
        appContext.close();
        LogFactory.release(Thread.currentThread().getContextClassLoader());
    } catch (Exception e) {
        logger.warn("Jboss could not be stopped", e);
    }
}

From source file:br.com.uol.runas.classloader.ClassLoaderGC.java

private void releaseFromBeans(WeakReference<ClassLoader> classLoader) {
    CachedIntrospectionResults.clearClassLoader(classLoader.get());
    Introspector.flushCaches();
}