• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reentrant calls on entity beans

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Reentrant property of my entity bean has been set as False. I believe that reentrant speaks mainly for the loopback within the same transaction context. My question is can different client programs invoke same method on the entity bean instance at the same point of time ?

for eg. two clients are accessing the same entity bean method in a loop. I am sure that in my code, recursive
behaviour is not there.

I such a situation I got "EJBException : Reentrant method call detected". I have tested setting the reentrant option as True and it was observed that the container exception is not seen anyfurther.

Can I take it like, the container cannot route multiple requests to the same instance and hence the exception ?

Response to this shall be highly appreciated.

Regards,

Rajesh
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is a common mis-conception that reentrant just applies to loopback calls. It really applies to concurrent access to a given bean instance of the Entity Bean in question. So basically by setting reentrant to true you are saying that more than one thread can access the same exact bean instance (or database row if you will) at the same time. This is actually a huge restriction with using Entity Beans prior to EJB 3.0.

So from the sounds of it your two clients are trying to access the same data... therein lays the problem.
 
rajesh LM
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Chris,

Thanks for your valuable reply.

>>>>It is a common mis-conception that reentrant just applies to loopback >>>>calls. It really applies to concurrent access to a given bean instance >>>>of the Entity Bean in question.

Can you please tell me the document reference from where you have seen that it really applies concurrent calls ?. This will help me to have more details on that.

Regards,

Rajesh
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the EJB 2.1 Specification, Section 10.5.12 Non-reentrant and Re-entrant Instances:



An entity Bean Provider can specify that an entity bean is non-reentrant. If an instance of a non-reentrant entity bean executes a client request in a given transaction context, and another request with the same transaction context arrives for the same entity object, the container will throw an exception to the second request. This rule allows the Bean Provider to program the entity bean as single-threaded, non-reentrant code.


[ April 13, 2006: Message edited by: Chris Mathews ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic