Maybe you could use
A: getTitle() {
return name + getSync().getName(getB());
}
B: getTitle() {
return name + getSync().getName(getA());
}
Where Sync is a Singleton with
Sync:
syncronised getName(Bean b){
return b.getName();
}
This way the threads run without interference until on of them calls the getName() of
Sync. At this point, one of them is prone to win the race, and the syncronisation within
Sync avoids the deadlock.
The penalty for the indirect call to Sync should not be too bad if the three beans are in
the same VM.
Didn't try it, though ;-)
Cheers ,
Georg
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257123#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...