• Post Reply Bookmark Topic Watch Topic
  • New Topic

Concurrency in SFSB  RSS feed

 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Ranchers!

I've just read in Andrew Lee Rubinger & Bill Burke book "Enterprise JavaBeans 3.1" that:

Enterprise JavaBeans 3.1 wrote:A bean provider may also optionally prohibit parallel invocations upon a particular stateful session via the use of @javax.ejb.ConcurrencyManagement".


Curiously, I've looked at this annotation: http://download.oracle.com/javaee/6/api/javax/ejb/ConcurrencyManagement.html

The only variable for this annotation is the default "value()" which is a ConcurrencyManagementType (http://download.oracle.com/javaee/6/api/javax/ejb/ConcurrencyManagementType.html) which takes two possible values - BEAN and CONTAINER.

As you can read in JavaDoc for ConcurrencyManagement:

http://download.oracle.com/javaee/6/api/javax/ejb/ConcurrencyManagement.html wrote:Declares a singleton session bean's concurrency management type.

If this annotation is not specified, the singleton bean is assumed to have container managed concurrency.

This annotation may be applied to stateful session beans, but doing so has no impact on the semantics of concurrency management for such beans. The concurrency management type for bean-managed concurrency (BEAN) does not apply to stateful session beans.


Besides the fact that the ConcurrencyManagement is defined for Singleton EJB's only, in case if I use it for SFSB, the default value is CONTAINER and the BEAN value doesn't even apply to SFSB.

So my question is - HOW can I prohibit concurrent access to the SFSB?

Cheers!

PS. Of course by "concurrent access" I mean a situation in which User A sends two requests to the same method to his SFSB.
I know that the container will serialize the requests for the same user by default, but the book says explicitly about prohibiting concurrent access (as well as the picture shows this mechanism)

EDIT: I can see that book mentions CONTAINER, BEAN and CONCURRENCY_NOT_SUPPORTED but I can't find the last one in Javadoc...
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just checked the errata for the book. You are right in your confusion because it is listed as a Serious Technical Mistake.
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, thanks a lot Mike!

Shame on me - I forgot to check the errata

So it should be @AccessTimeout(0) which will prevent concurrent access to SFSB.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!