This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes 7.11.8 Non-reentrant instances Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "7.11.8 Non-reentrant instances" Watch "7.11.8 Non-reentrant instances" New topic
Author

7.11.8 Non-reentrant instances

Giju George
Ranch Hand

Joined: Jun 08, 2004
Posts: 333
spec 7.11.8 says :-
---------------------------------------------
"Note that a session object is intended to support only a single client. Therefore, it would be an application error if two clients attempted to invoke the same session object."
----------------------------------------------
Fine... I understand. But my ques is :-

Will this scenario EVER happens in the container???


As far as I understand, the container will be creating another instance of the bean, unless it's an entity bean.


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCEA
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Giju,

In a case with the stateless session beans one bean instance can service multiple clients as long as the clients are not concurrent.

I am not exactly sure how to replicate the concurrent access on the same stateless session bean in order to test that the container does throw an error.
I'd say that the client program gets hold of EJBObject(through home create method). Then client runs two threads with each calling methods on this EJBObject. If these two threads invoke a method on the bean (through the same EJBObject) at the same time it will mean we are accessing one bean concurrently. I guess I'll have to try it now

Regards.


Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: 7.11.8 Non-reentrant instances
 
Similar Threads
Doubt of instances pool
"client view", "transparent" ... what do they mean exactly?
EJB spec 101: 7.11.8 --> Non-re-entrant instances
Stateful sessionbean - Re-Entrant property clarification
Maintaing everthing in Session Object