|
|
|
When the session is destroyed (e.g. due to logging out), then its conversations are destroyed right away, in the {{session.invalidate();}} call. According to spec, this is wrong. CDI 1.2 spec 6.7.4. Conversation context lifecycle: {quote} When the HTTP servlet session is invalidated, all long-running conversation contexts created during the current session are destroyed, after the servlet service() method completes. {quote}
{panel:title=asd} When the session is destroyed (e.g. due to logging out), then the current associated conversation is destroyed right away, in the {{session.invalidate();}} call. Judging by the {{AbstractConversationContext#destroy}} code and comments, that's not intended: {code} for (ManagedConversation conversation : conversations.values()) { String id = conversation.getId(); if (!conversation.isTransient()) { // the currently associated conversation will be destroyed at the end of the current request conversation.end(); } if (!isCurrentConversation(id)) { // a conversation that is not currently associated is destroyed immediately destroyConversation(session, id); } } {code} The {{conversation.end}} call marks the current conversation as transient. Then {{isCurrentConversation}} wants to get the current conversation id: {code} return id !=null && id.equals(getCurrentConversation().getId()); {code} But {{ConversationImpl#getId}} will return null, since it's transient now: {code} if (!_transient) { return id; } else { return null; } {code} Thus {{isCurrentConversation}} will return false, and the current conversation will be destroyed immediately. This is problematic if you intend to use the current conversation again before the request is over. Reproducer: [^weld conversation destroyed too early.zip].
{panel}
|
|
|
|