This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Loopback exception example Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "Loopback exception example" Watch "Loopback exception example" New topic
Author

Loopback exception example

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Hi,

I have read in Ivan Krizsan's notes (great job!) - page 65 (Reentrant locking) about loopback exception.

Why the following code does not throw mentioned exception?:

Could you give me an example when such exception can occur?


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
E Armitage
Ranch Hand

Joined: Mar 17, 2012
Posts: 220
a calling b here is very bad because most likely the @Lock(LockType.WRITE) is ignored since transaction and (just by inference) also concurrency attributes are only applied in a client view mode.
i.e the attributes are only applied when the business method is being invoked from some injected or looked up reference of the bean.
Here post and a will not throw exceptions because the container will allow multiple threads to access the methods
and b called through a is really run in READ mode as well. (i.e b is not considered a business method when called through method a).

To get an exception, set the @AccessTimeout value to zero for method b, make method b do some longish task and call method b twice (one call after another) from a client view of the bean or two different clients of the bean. The second call should get the javax.ejb.ConcurrentAccessException.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Loopback exception example
 
Similar Threads
Again reachable
44/80.....damn locking!
I want to execution of a Threads in sequence
throwing exception from finally block (try-finally clause without catch block)
Why notify is throwing an exception here ?