Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1775

Initialized(ConversationScoped) observers not called with lazy conversation context initialization

XMLWordPrintable

    • Hide

      Add to web.xml:

      <context-param>
      	<param-name>org.jboss.weld.context.conversation.lazy</param-name>
      	<param-value>true</param-value>
      </context-param>
      

      Create an observer:

      public class ConversationTimeoutDefaultSetter {
      
      	@Inject
      	private Conversation conversation;
      
      	public void conversationInitialized(@Observes @Initialized(ConversationScoped.class) ServletRequest payload) {
      		conversation.setTimeout(1800000L);
      	}
      }
      

      See observer not getting called.

      Show
      Add to web.xml: <context-param> <param-name>org.jboss.weld.context.conversation.lazy</param-name> <param-value> true </param-value> </context-param> Create an observer: public class ConversationTimeoutDefaultSetter { @Inject private Conversation conversation; public void conversationInitialized(@Observes @Initialized(ConversationScoped.class) ServletRequest payload) { conversation.setTimeout(1800000L); } } See observer not getting called.

      When the lazy conversation context initialization is enabled explicitly in web.xml, the conversation initialization observers do not get called at all, while conversation destruction observers do get called just fine.

      I've seen WELD-1559.

      We cannot fire the event without knowing if the current conversation is long-running or not which forces us to determine that non-lazily.

      And CDI spec 6.7.4:

      The conversation scope is active during all Servlet requests.

      So it figures that lazy conversation context is at odds with the spec, but that doesn't mean initialization observers should not get called at all. They should be called whenever a conversation is actually initialized.

            mkouba@redhat.com Martin Kouba
            vsevolodgol Vsevolod Golovanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: