• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about Reentrant

 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The mock exam in HFEJB for the MDB chapter says :

The container should treat MDB instances as non-reentrant.

I somehow got this question right by eliminating the other 3 options
Can someone tell me what does non-reentrant mean?

Also in an entity bean's DD, we have <reentrant>False</reentrant>. What does this mean? Is this covered in the exam?

Thanks
 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A generic description of reentrancy would be like this:
For any two beans A and B, if you call B's method from A, and subsequently try to call A's method from B, and the call goes through fine, then A is said to be reentrant.

From sec 10.5.11 of EJB 2.0 Spec:
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.

The functionality of entity beans with container-managed persistence may require loopbacks in the same transaction context. An example of a loopback is when the client calls entity object A, A calls entity object B, and B calls back A in the same transaction context. The entity bean�s method invoked by the loopback shares the current execution context (which includes the transaction and security contexts) with the Bean�s method invoked by the client.
 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you call bean B's method from bean A, and if bean B tries to call bean A's method again (called a loopback) in the same txn context, then the container will not be able to distinguish such a call from a concurrent access call within a single txn. Setting <reentrant> to True will permit such an operation.
 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some more threads in this forum pertaining to this topic.

Stateful sessionbean - Re-Entrant property clarification

reentrant???
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic