Well, it would seem to me that a ThreadLocal instance could help solve
this problem. If one thread tries to acquire a lock it already owns, it
ought to get it, right?
If we were to apply the same semantics you describe to a simple Java
class, then calling setX would always block...
class C
{
synchronized void setX() {
setY();
}
synchronized void setY() {
;
}
}
If this is really the way JBoss works, and nobody knows a good reason
why it should, can someone point me to the package/class responsible for
this behavior and I'll take a whack at fixing it?
Thanks,
Jim
On Thu, 2002-10-24 at 15:40, Michael Bartmann wrote:
> Explanation attempt inline.
>
> Regards,
> Michael Bartmann
>
> Jim Crossley wrote:
> > I have an MDB with the following pseudocode in its onMessage method:
> >
> > public void onMessage(Message msg)
> > {
> > // Entity bean = home.create(...)
> > // bean.setX(...)
> this starts a tx1 and locks the instance bean.
> > // bean.setY(...)
> this suspends the tx1 on bean temporarily,
> and starts a tx2, which tries to obtain the lock on the bean,
> which it will never get, because tx1 is not commited or rollbacked
> yet.
> We had this problem under 2.4.4 w/o deadlock detection. Problem:
> even the tx timeout didn't work in this case; the server locked forever... :-(
> > }
> >
> > Each of the three methods, create, setX, and setY have a trans-attribute
> > of "RequiresNew". With only one client posting a message, a "deadlock
> > detected" exception is thrown when setX is invoked. How can deadlock
> > occur when only one thread is active
> >
> > Thanks,
> > Jim
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by: Influence the future
> > of Java(TM) technology. Join the Java Community
> > Process(SM) (JCP(SM)) program now.
> > http://ad.doubleclick.net/clk;4729346;7592162;s?http://www.sun.com/javavote
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
> >
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: Influence the future
> of Java(TM) technology. Join the Java Community
> Process(SM) (JCP(SM)) program now.
> http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0003en
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
-------------------------------------------------------
This sf.net email is sponsored by: Influence the future
of Java(TM) technology. Join the Java Community
Process(SM) (JCP(SM)) program now.
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0003en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user