Transaction.rollback method also calls beforeCompletion
-------------------------------------------------------
Key: GERONIMO-4449
URL: https://issues.apache.org/jira/browse/GERONIMO-4449
Project: Geronimo
Issue Type: Bug
Security Level: public (Regular issues)
Components: transaction manager
Affects Versions: 2.2
Reporter: Lin Sun
Assignee: Lin Sun
Per JTA 1.1 spec, page 33:
The beforeCompletion method is called by the transaction manager prior to the
start of the two-phase
transaction commit process.This call is executed with the transaction context
of the transaction that is being
committed. An unchecked exception thrown by a registered Synchronization
object causes the transaction to
be aborted. That is, upon encountering an unchecked exception thrown by a
registered synchronization
object, the transaction manager must mark the transaction for rollback.
The spec seems to indicate that beforeCompletion is not called during rollback,
but afterCompletion is called during(or after) both rollback and commit.
So I expect the following to pass:
{code}
public void testNormalSynchIsNotCalledOnRollback() throws Exception {
normalSync = new CountingSync();
tm.begin();
tm.getTransaction().registerSynchronization(normalSync);
tm.rollback();
assertFalse(normalSync.beforeCompletionCalled());
assertTrue(normalSync.afterCompletionCalled());
}
{code}
In geronimo, we call beforeCompletion inside of the rollback method in
TransactionImpl.java, which seems incorrect to me.
Thoughts?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.