-
1. Re: EJB and Transaction in JBoss, urgent help required
adrian.brock Apr 21, 2003 1:58 PM (in response to divine_comedy)There could be any number of causes for this.
1) There were some fixes done in this area so
try 3.0.7
2) You haven't implemented the primary key
correctly.
3) Some other thread is doing a long running
process on the bean and thereby locking it.
The default locking strategy is pessimisstic.
Regards,
Adrian -
2. Re: EJB and Transaction in JBoss, urgent help required
divine_comedy Apr 21, 2003 11:08 PM (in response to divine_comedy)I've experimented around further with this, and I need some input regarding the use of UserTransaction and its semantics. What happens if I did the following :
userTransaction.begin();
bean.getStatus();
and at the same time, another thread runs that does
findAllBeansWithStatusXXX;
iterate through the beans
bean.getStatus();
the threads ran in different MBeans.
My experiment causes a lot of transaction timeouts and beanlocks. Am I doing something really wrong here ? -
3. Re: EJB and Transaction in JBoss, urgent help required
adrian.brock Apr 22, 2003 4:10 AM (in response to divine_comedy)The first invoke bean.getStatus() locks
the bean to the user transaction.
It will remain locked until the user transaction
is committed or rolled back.
The other transactions will wait until the lock
is released or the transaction times out.
If you didn't intend to lock, try searching
for <read-only> methods and other
locking policies.
They are explained in more detail in the $10 docs.
Regards,
Adrian -
4. Re: EJB and Transaction in JBoss, urgent help required
divine_comedy Apr 22, 2003 12:34 PM (in response to divine_comedy)Thanks Adrian. That's what I thought should happen as well. I've run another experiment where I only let the first MBean run. With the same code running, here's what I got, the first time the MBean runs it is fine all the way until I do a UserTransaction.commit. 5 mins later, the MBean runs again and I got this exception : "Transaction already active, cannot nest transactions".
I thought a commit should release locks on all beans involved in the transaction. I dig around in the logs and there doesn't seem to be an exception caused by a transaction.commit or transaction.rollback.
Just for reference the code :
try {
ut.begin();
order.getStatus();
.... some code
ut.commit();
} catch (SomeException e) {
if( ut.getStatus != "NO_TRANSACTION") {
ut.rollback();
}
} -
5. Re: EJB and Transaction in JBoss, urgent help required
divine_comedy Apr 22, 2003 2:20 PM (in response to divine_comedy)Forget it, I finally fixed it. Turns out that I forgot to do a commit() in one of the early return statement so I was having a transaction leak.
However, I wonder what happens if a commit or rollback fails ? Can anybody shed some light on this ?
Would all the beans that have been locked be released ?