[jboss-user] [JBoss Seam] - concurrency of conversation-scoped components

azalea do-not-reply at jboss.com
Mon Jul 2 09:39:17 EDT 2007


Hi,

I have two questions.

1. JBoss Seam 2.0.0.BETA1 Reference Guide - 3.1.10. Concurrency model:
anonymous wrote : 
  | 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. 

  | @Stateful
  | @Name("concurrencyTesting")
  | public class ConcurrencyTestingAction
  | 				implements ConcurrencyTesting, Serializable {
  | 
  | 	private int count;
  | 	
  | 	@In
  | 	private FacesMessages facesMessages;
  | 	
  | 	@Logger
  | 	private Log log;
  | 
  | 	@Begin
  | 	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);
  | 		}
  | 		count++;
  | 		facesMessages.add("doLongWork: count[#0]", count);
  | 		log.debug("doLongWork end:count[#0]", count);
  | 	}
  | 
  | 	public void doShortWork() {
  | 		log.debug("doShortWork start:count[#0]", count);
  | 		count++;
  | 		facesMessages.add("doShortWork: count[#0]", count);
  | 		log.debug("doShortWork end:count[#0]", count);
  | 	}
  | 
  | 	public int getCount() {
  | 		return count;
  | 	}
  | 	
  | 	@End
  | 	public void end() {}
  | 
  | 	@Destroy @Remove
  | 	public void destroy() {}
  | }
  | 

I also have next xhml file.

  |   ... ...
  | 
  |   <h:messages globalOnly="true" styleClass="message"/>
  |     
  |   <ul>
  |     <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>
  |   </ul>
  | 
  |   ... ...
  | 

(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)

Thanks.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059611#4059611

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059611



More information about the jboss-user mailing list