session.getId());
}
session.invalidate();
}
}
ApplicationAssociate associate = ApplicationAssociate.getInstance(sc);
if (associate != null) {
BeanManager manager = associate.getBeanManager();
for (Map.Entry<String,BeanBuilder> entry : manager.getRegisteredBeans().entrySet()) {
String name = entry.getKey();
BeanBuilder bean = entry.getValue();
if (bean.getScope() == ELUtils.Scope.APPLICATION) {
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.log(Level.INFO,
"Removing application scoped managed bean: {0}",
name);
}
sc.removeAttribute(name);
}
}
}
// Release any allocated application resources
FactoryFinder.releaseFactories();
} catch (Exception e) {
e.printStackTrace();
} finally {
FacesContext initContext = new InitFacesContext(sc);
ApplicationAssociate
.clearInstance(initContext.getExternalContext());
ApplicationAssociate.setCurrentInstance(null);
// Release the initialization mark on this web application
ConfigManager.getInstance().destory(sc);
initContext.release();
ReflectionUtils.clearCache(Thread.currentThread().getContextClassLoader());
WebConfiguration.clear(sc);
}
// bring the application back up, avoid re-registration of certain JSP
// artifacts. No verification will be performed either to make this
// light weight.
// init a new WebAppLifecycleListener so that the cached ApplicationAssociate
// is removed.
webAppListener = new WebappLifecycleListener(sc);
FacesContext initContext = new InitFacesContext(sc);
ReflectionUtils
.initCache(Thread.currentThread().getContextClassLoader());
try {
ConfigManager configManager = ConfigManager.getInstance();
configManager.initialize(sc);
registerELResolverAndListenerWithJsp(sc, true);
ApplicationAssociate associate =
ApplicationAssociate.getInstance(sc);
if (associate != null) {
associate.setContextName(getServletContextIdentifier(sc));
}
RenderKitUtils.loadSunJsfJs(initContext.getExternalContext());
} catch (Exception e) {
e.printStackTrace();
} finally {