• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Concurrency in SFSB

 
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 144
Oracle Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Those are the largest trousers in the world! Especially when next to this ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic