Search in sources :

Example 1 with EagerSessionBeanStore

use of org.jboss.weld.module.web.context.beanstore.http.EagerSessionBeanStore in project core by weld.

the class HttpSessionContextImpl method destroy.

public boolean destroy(HttpSession session) {
    final BoundBeanStore beanStore = getBeanStore();
    if (beanStore == null) {
        try {
            HttpConversationContext conversationContext = getConversationContext();
            setBeanStore(new EagerSessionBeanStore(namingScheme, session));
            activate();
            invalidate();
            conversationContext.destroy(session);
            deactivate();
            setBeanStore(null);
            return true;
        } finally {
            cleanup();
        }
    } else {
        // We are in a request, invalidate it
        invalidate();
        if (beanStore instanceof AttributeBeanStore) {
            AttributeBeanStore attributeBeanStore = ((AttributeBeanStore) beanStore);
            if (attributeBeanStore.isAttributeLazyFetchingEnabled()) {
                // At this moment we have to sync the local bean store and the backing store
                attributeBeanStore.fetchUninitializedAttributes();
            }
        }
        getConversationContext().destroy(session);
        return false;
    }
}
Also used : AttributeBeanStore(org.jboss.weld.contexts.beanstore.AttributeBeanStore) BoundBeanStore(org.jboss.weld.contexts.beanstore.BoundBeanStore) HttpConversationContext(org.jboss.weld.context.http.HttpConversationContext) EagerSessionBeanStore(org.jboss.weld.module.web.context.beanstore.http.EagerSessionBeanStore)

Aggregations

HttpConversationContext (org.jboss.weld.context.http.HttpConversationContext)1 AttributeBeanStore (org.jboss.weld.contexts.beanstore.AttributeBeanStore)1 BoundBeanStore (org.jboss.weld.contexts.beanstore.BoundBeanStore)1 EagerSessionBeanStore (org.jboss.weld.module.web.context.beanstore.http.EagerSessionBeanStore)1