aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ConcurrentAccessException with singleton bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "ConcurrentAccessException with singleton bean" Watch "ConcurrentAccessException with singleton bean" New topic
Author

ConcurrentAccessException with singleton bean

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 775
On p.58 of Frits notes,

ConcurrentAccessException - Indicates that the client has attempted an invocation on a stateful session bean or singleton bean while another invocation is in progress and such concurrent access is not allowed.


However, on p.23 of the notes,

A singleton session bean instance is shared between clients and support concurrent access.


Due to the fact that a singleton session bean support concurrent access, why the single bean will throw ConcurrentAccessException?
Mike Degteariov
Ranch Hand

Joined: Oct 03, 2007
Posts: 62
    
    8

Singleton session bean indeed supports concurrent access, and various aspects of its concurrency can be tweaked using following annotations:


@ConcurrencyManagement
@Lock
@AccessTimeout

So, for instance, if a concurrency management is in its default state (which is @ConcurrencyManagement(CONTAINER)) and the method is of locking type WRITE, client access to all the singleton’s methods is blocked until the current client finishes its method call or an access timeout occurs. When an access timeout occurs, the EJB container throws a javax.ejb.ConcurrentAccessTimeoutException - which is a child of javax.ejb.ConcurrentAccessException
In other cases, like, if a locking type used is READ, or @ConcurrencyManagement(BEAN) is used, simultaneous access to the bean is permitted, and ConcurrentAccessException will not be thrown upon concurrent calls.

Refer to the tutorial for further details.


Mike Degteariov
SCJP5 SCWCD5 SCBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ConcurrentAccessException with singleton bean