use of org.apache.openejb.cdi.WebappWebBeansContext in project tomee by apache.
the class BeginWebBeansListener method requestDestroyed.
/**
* {@inheritDoc}
*/
@Override
public void requestDestroyed(final ServletRequestEvent event) {
if (webBeansContext == null) {
return;
}
if (logger.isDebugEnabled()) {
logger.debug("Destroying a request : [{0}]", event == null ? "null" : event.getServletRequest().getRemoteAddr());
}
final Object oldContext;
if (event != null) {
oldContext = event.getServletRequest().getAttribute(contextKey);
} else {
oldContext = null;
}
try {
// clean up the EL caches after each request
final ELContextStore elStore = ELContextStore.getInstance(false);
if (elStore != null) {
elStore.destroyELContextStore();
}
contextsService.endContext(RequestScoped.class, event);
if (webBeansContext instanceof WebappWebBeansContext) {
// end after child
((WebappWebBeansContext) webBeansContext).getParent().getContextsService().endContext(RequestScoped.class, event);
}
} finally {
contextsService.removeThreadLocals();
ThreadSingletonServiceImpl.enter((WebBeansContext) oldContext);
}
}
Aggregations