Discussions

EJB programming & troubleshooting: Concurrent calls to entity beans

  1. Concurrent calls to entity beans (1 messages)

    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
  2. Concurrent calls to entity beans[ Go to top ]

    Rajesh,
      There are two aspects to be considered in your situation .

    1) If you are planning to call the same method of Entity bean for two different instances (i.e. having 2 different primary keys ) , then the bean will throw a transaction rollback exception if the isolation level set for the bean is TX_Serializable . It will not throw any exception for any other isolation levels .
    2) If you are planning to call the method of Entity bean having the same primary key , then the bean will throw a transaction rollback exception if the the isolation level is either repeatable_read,serializable or read_commited (if you are trying to write ). It will not throw any exception it it is read_uncommitted .

    Now in both the above cases different transactions are initiated by different clients. The case is re-entrant only when the same method of the same bean instance gets called in the same transaction . If your scenario happens to be that , then you need to make the bean re-entrant . Hope this answers your query .

    Cheers
    Debashish