private void destroyFakedRequest() { final Boolean faked = FAKE_REQUEST.get(); try { if (faked != null && faked) { requestDestroyed(null); } } finally { FAKE_REQUEST.remove(); } }
@Override public void invalidate() { listener.sessionDestroyed(new HttpSessionEvent(session)); } }
@Override public void contextDestroyed(final ServletContextEvent servletContextEvent) { destroyFakedRequest(); } }
private static HttpRequestImpl initCdi(final WebBeansContext context, final HttpRequestImpl request) { try { if (context.getBeanManagerImpl().isInUse()) { request.setBeginListener(new BeginWebBeansListener(context)); request.setEndListener(new EndWebBeansListener(context)); } } catch (IllegalStateException ise) { // no-op: ignore } return request; }
private static HttpRequestImpl initCdi(final HttpRequestImpl request) { try { final WebBeansContext context = WebBeansContext.currentInstance(); if (context.getBeanManagerImpl().isInUse()) { request.setBeginListener(new BeginWebBeansListener(context)); request.setEndListener(new EndWebBeansListener(context)); } } catch (final IllegalStateException ise) { // no-op: ignore } return request; }
final EndWebBeansListener endWebBeansListener = new EndWebBeansListener(webBeansContext); final EndWebBeansListener endWebBeansListener = new EndWebBeansListener(webBeansContext);
public void destroy() { if (end != null && getAttribute("openejb_requestDestroyed") == null) { setAttribute("openejb_requestDestroyed", "ok"); end.requestDestroyed(new ServletRequestEvent(getServletContext(), this)); } }
private void doDestroy(final SessionWrapper next) { HttpSessionEvent event = null; if (next.end != null) { event = new HttpSessionEvent(next.session); next.end.sessionDestroyed(event); next.begin.sessionCreated(event); // just set session thread local } try { next.session.invalidate(); } finally { if (next.begin != null) { next.begin.sessionDestroyed(event); } } }
@Override public void contextInitialized(final ServletContextEvent servletContextEvent) { destroyFakedRequest(); }
public void destroy() { final boolean openejbRequestDestroyed = getAttribute("openejb_requestDestroyed") == null; if (listeners != null && !listeners.isEmpty()) { if (begin != null && end != null && openejbRequestDestroyed) { end.requestDestroyed(new ServletRequestEvent(getServletContext(), this)); } final ServletRequestEvent event = new ServletRequestEvent(getServletContext(), this); for (final ServletRequestListener listener : listeners) { listener.requestDestroyed(event); } } if (begin != null && openejbRequestDestroyed) { setAttribute("openejb_requestDestroyed", "ok"); begin.requestDestroyed(new ServletRequestEvent(getServletContext(), this)); } }
@Override public void sessionWillPassivate(final HttpSessionEvent event) { if (webBeansContext == null) { return; } if (failoverService != null && failoverService.isSupportPassivation()) { failoverService.sessionWillPassivate(event.getSession()); } destroyFakedRequest(); }
/** * {@inheritDoc} */ @Override public void sessionDestroyed(final HttpSessionEvent event) { if (webBeansContext == null) { return; } if (logger.isDebugEnabled()) { logger.debug("Destroying a session with session id : [{0}]", event.getSession().getId()); } // ensure session ThreadLocal is set webBeansContext.getContextsService().startContext(SessionScoped.class, event.getSession()); webBeansContext.getContextsService().endContext(SessionScoped.class, event.getSession()); if (WebappWebBeansContext.class.isInstance(webBeansContext)) { // end after child WebappWebBeansContext.class.cast(webBeansContext).getParent().getContextsService().endContext(SessionScoped.class, event.getSession()); } final ConversationManager conversationManager = webBeansContext.getConversationManager(); final Map<Conversation, ConversationContext> cc = conversationManager.getAndRemoveConversationMapWithSessionId(event.getSession().getId()); for (final ConversationContext c : cc.values()) { if (c != null) { c.destroy(); } } destroyFakedRequest(); }