Problem: concurrent call to the stored conversation
kruno Mar 14, 2008 1:13 PMI have a problem, example will explain:
JSP page
<h:form id="forma"> <a:commandButton eventsQueue="red" value="AJAX" action="#{kruno.odradi2}"/> <s:button value="SEAM" action="#{kruno.odradi2}"></s:button> </h:form>
Seam component:
@Name("kruno") @Scope(ScopeType.CONVERSATION) public class KrunoTest { .... @In Operater operKonv; @SuppressWarnings("unchecked") public void odradi2() { log.debug("ENTER odradi 2"); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } log.debug("EXIT odradi 2"); }
if one presses SEAM button on jsp page, and does not wait 3 seconds so server could finish request but presses AJAX button you get exception:
12:46:59,150 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: RESTORE_VIEW 1 12:46:59,150 [http-127.0.0.1-8080-1] DEBUG org.jboss.seam.contexts.FacesLifecycle :50 - >>> Begin JSF request 12:46:59,151 [http-127.0.0.1-8080-1] DEBUG org.jboss.seam.jsf.SeamPhaseListener :565 - beginning transaction prior to phase: RESTORE_VIEW 1 12:46:59,153 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :173 - after phase: RESTORE_VIEW 1 12:46:59,154 [http-127.0.0.1-8080-1] DEBUG org.jboss.seam.core.Manager :491 - Restoring conversation with id: 3 12:46:59,160 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: APPLY_REQUEST_VALUES 2 12:46:59,161 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :173 - after phase: APPLY_REQUEST_VALUES 2 12:46:59,162 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: PROCESS_VALIDATIONS 3 12:46:59,163 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :173 - after phase: PROCESS_VALIDATIONS 3 12:46:59,163 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: UPDATE_MODEL_VALUES 4 12:46:59,164 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :173 - after phase: UPDATE_MODEL_VALUES 4 12:46:59,165 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: INVOKE_APPLICATION 5 12:46:59,166 [http-127.0.0.1-8080-1] DEBUG orka.core.test.KrunoTest :83 - USao u odradi 2 12:46:59,643 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: RESTORE_VIEW 1 12:46:59,644 [http-127.0.0.1-8080-2] DEBUG org.jboss.seam.contexts.FacesLifecycle :50 - >>> Begin JSF request 12:46:59,645 [http-127.0.0.1-8080-2] DEBUG org.jboss.seam.jsf.SeamPhaseListener :565 - beginning transaction prior to phase: RESTORE_VIEW 1 12:46:59,647 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :173 - after phase: RESTORE_VIEW 1 12:47:00,648 [http-127.0.0.1-8080-2] DEBUG org.jboss.seam.core.Manager :510 - No stored conversation, or concurrent call to the stored conversation 12:47:00,652 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: APPLY_REQUEST_VALUES 2 12:47:00,653 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :173 - after phase: APPLY_REQUEST_VALUES 2 12:47:00,654 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: PROCESS_VALIDATIONS 3 12:47:00,654 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :173 - after phase: PROCESS_VALIDATIONS 3 12:47:00,655 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: UPDATE_MODEL_VALUES 4 12:47:00,656 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :173 - after phase: UPDATE_MODEL_VALUES 4 12:47:00,656 [http-127.0.0.1-8080-2] TRACE org.jboss.seam.jsf.SeamPhaseListener :104 - before phase: INVOKE_APPLICATION 5 12:47:00,664 [http-127.0.0.1-8080-2] WARN javax.enterprise.resource.webcontainer.jsf.lifecycle :103 - org.jboss.seam.RequiredException: @In attribute requires non-null value: kruno.operKonv javax.el.ELException: org.jboss.seam.RequiredException: @In attribute requires non-null value: kruno.operKonv at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:338)
As it can be seen there is concurrent call to the stored conversation.
The question is. Is there an elegant way to block concurrent
calls when you have mixed ajax commandButtons and clasical commandButtons