[jboss-dev-forums] [EJB Development] - Entity bean deadlock
bartatamas
do-not-reply at jboss.com
Fri Sep 25 08:08:23 EDT 2009
Hi!
I have two entity beans for example: A, B
There is a relation between these beans, and I have to be able to access B from A and A from B.
A: getTitle() {
return name + getB().getName();
}
B: getTitle() {
return name + getA().getName();
}
When a thread calls A.getTitle() and an other thread calls B.getTitle(), there can be a deadlock: thread1 locks A; thread2 locks B; thread1 waits for B; thread2 waits for A -> deadlock
What can I do to avoid these deadlock? Read-only method declaration isn't enough. I have to call the beans from each other. The real situation is much more difficult, it is only a simplified case.
How can I obtain that a get method doesn't lock the bean itself?
Thanks, Tamas
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257064#4257064
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257064
More information about the jboss-dev-forums
mailing list