|
If JtaTransaction is the initiator of the UserTransaction, when you register a synchronization it doesn't register a synchronization with the JtaPlatform (see TransactionCoordinatorImpl.java:227).
When the JtaTransaction commits, it commits the UserTransaction (as the JtaTransaction is the initiator of it), but afterTransactionCompletion(int status) in JtaTransaction is a noop, so the Synchronization is not called here.
The Synchronization is called by afterAfterCompletion() in JtaTransaction, passing the status of the UserTransaction. However at this time the UserTransaction has been committed and is now gone, so userTransaction.getStatus() returns STATUS_NO_TRANSACTION.
What I expect is for the Synchronization to be called with the STATUS_COMMITTED status (as this is what happened), however it is called with the STATUS_NO_TRANSACTION status.
Is this a fault? I have "remedied" it by sending completion notifications in afterTransactionCompletion(int status)... although this results in afterAfterCompletion() still reporting the STATUS_NO_TRANSACTION afterwards (unless I call transactionCoordinator().afterTransaction( this, status ); in afterTransactionCompletion(int status)... but I'm not sure whether I'm doing right!)
|