[jboss-dev-forums] [Design of EJB 3.0] - EJBTHREE-1142 - Incomplete fix - Generic problem
adrian@jboss.org
do-not-reply at jboss.com
Mon Dec 3 10:01:05 EST 2007
I linked this issue to where it was originally reported
http://jira.jboss.com/jira/browse/JBAS-4980
But the fix shows what is generally wrong with a lot of the EJB3 code
(especially the deployment stuff).
|
| // Commit or rollback depending on the status
| if (commit == false || transaction.getStatus() == Status.STATUS_MARKED_ROLLBACK)
| {
| if (trace)
| log.trace("MessageEndpoint " + getProxyString(proxy) + " rollback");
| tm.rollback();
| }
| else
| {
| if (trace)
| log.trace("MessageEndpoint " + getProxyString(proxy) + " commit");
| tm.commit();
| }
|
| // We're done with the transaction
| transaction = null;
|
So if tm.commit() throws an error, the transaction variable is not cleared
meaning the problem is not fixed.
The nulling of the transaction variable should be in the finally block further down:
| finally
| {
| + transaction = null;
|
| // Resume any suspended transaction
| if (currentTx != null)
| {
| try
| {
| tm.resume(currentTx);
| }
| catch (Throwable t)
| {
| log.warn("MessageEndpoint " + getProxyString(proxy) + " failed to resume old transaction " + currentTx);
|
| }
| }
| }
|
Basically, the code works great under normal circumstances
but falls apart on any error.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109874#4109874
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109874
More information about the jboss-dev-forums
mailing list