3 Replies Latest reply on Jul 7, 2007 1:48 AM by Fumihiko Sugiyama

    concurrency of conversation-scoped components

    Fumihiko Sugiyama Newbie


      I have two questions.

      1. JBoss Seam 2.0.0.BETA1 Reference Guide - 3.1.10. Concurrency model:

      Seam enforces a single thread per conversation per process model for the conversation context by serializing concurrent requests in the same long-running conversation context.

      What is "per process" here?
      JVM? JSF event-handler? request process? business process? others?

      2. I have the following Seam SFSB.
      public class ConcurrencyTestingAction
       implements ConcurrencyTesting, Serializable {
       private int count;
       private FacesMessages facesMessages;
       private Log log;
       public void start() {}
       public void doLongWork() {
       log.debug("doLongWork start:count[#0]", count);
       try {
       Thread.sleep(60 * 1000);
       } catch (InterruptedException e) {
       log.debug("InterruptedException occured.", e);
       facesMessages.add("doLongWork: count[#0]", count);
       log.debug("doLongWork end:count[#0]", count);
       public void doShortWork() {
       log.debug("doShortWork start:count[#0]", count);
       facesMessages.add("doShortWork: count[#0]", count);
       log.debug("doShortWork end:count[#0]", count);
       public int getCount() {
       return count;
       public void end() {}
       @Destroy @Remove
       public void destroy() {}

      I also have next xhml file.
       ... ...
       <h:messages globalOnly="true" styleClass="message"/>
       <li><s:link value="conversation start" action="#{concurrencyTesting.start}" /></li>
       <li><s:link value="conversation end" action="#{concurrencyTesting.end}" /></li>
       <li><s:link value="short work" action="#{concurrencyTesting.doShortWork}" /></li>
       <li><s:link value="long work" action="#{concurrencyTesting.doLongWork}" /></li>
       ... ...

      (1)Start the conversation by clicking "conversation start" link in browser tab #1.
      (2)Open a new tab #2 with right clicking on the "short work" link.
      (3)Invoke #{concurrencyTesting.doLongWork} event-handler, which sleeps in 60 secs, in tab #1.

      If I invoke #{concurrencyTesting.doLongWork} event-handler quickly in tab#2(concurrent request for same conversation),
      the method invocation is blocked.
      And when the processing in tab #1 is over, the method invocation in tab #2 starts.
      This is OK!

      But if I invoke #{concurrencyTesting.doShortWork} instead of #{concurrencyTesting.doLongWork} in tab #2,
      this method is invoked immediately with a new temporary conversation.
      I expected that the method invocation was also blocked...
      Is this Seam spec?

      JBoss AS 4.2.0.GA
      JBoss Seam CVS(before about 12 hours)