Do container prevent deadlock?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jacky_Chan
Posted On:   Tuesday, December 30, 2008 11:08 PM

Does the order in which entity beans are called matter for deadlocks? Assume that there are 2 entity beans, A and B. Client 1 connects to entity bean A and then to entity bean B. Client 2 connects to the same entity beans, but in the opposite order. Now, since containers usually lock entity beans when they are referenced, I fear a deadlock possibility. Let's break the scenario up in a few steps Assume that client 1 has got a reference (and thus a lock) to bean A and client 2 has got a reference (and a lock) to bean B. When client 1 wants to get a reference to bean B it has to wait for it to be released by client 2. Client 2 then tries to get a reference to bean A but has to wait, because it's locked by cli   More>>

Does the order in which entity beans are called matter for deadlocks?
Assume that there are 2 entity beans, A and B.

Client 1 connects to entity bean A and then to entity bean B.

Client 2 connects to the same entity beans, but in the opposite order.

Now, since containers usually lock entity beans when they are referenced, I fear a deadlock possibility. Let's break the scenario up in a few steps

Assume that client 1 has got a reference (and thus a lock) to bean A and client 2 has got a reference (and a lock) to bean B. When client 1 wants to get a reference to bean B it has to wait for it to be released by client 2. Client 2 then tries to get a reference to bean A but has to wait, because it's locked by client 1. A deadlock has ocurred.

If this is a possibility, then that means that people have to be careful to always use the same order when referencing entity beans in a transaction. Can anyone tell me if this is true? I think this is really a terrible restriction, if it is.

   <<Less
About | Sitemap | Contact