dcsimg
Do containers prevent deadlocks?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jon_Thorarinsson
Posted On:   Monday, September 30, 2002 06:32 AM

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    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

Re: Do containers prevent deadlocks?

Posted By:   Jon_Thorarinsson  
Posted On:   Monday, September 30, 2002 06:45 AM

I want to add something to my question:


If the order in which you connect to your entity beans doesn't matter at all, how does the container prevent deadlocks?

About | Sitemap | Contact