[hibernate-dev] afterTransactionCompletion(status) in JtaTransaction
Sanne Grinovero
sanne at hibernate.org
Wed Jul 18 11:27:00 EDT 2012
Hi Steve,
thanks for the clarification.
Wouldn't it make sense then to add the "int status" as an argument to
afterAfterTransaction as well? As it seems some code looks for this by
invoking tx.getStatus() in implementations of this method, but that
seems unsafe as I've found cases in which this gets the wrong status
code at that point.
Sanne
On 18 July 2012 16:19, Steve Ebersole <steven.ebersole at gmail.com> wrote:
> afterAfterTransaction is simply a part of the afterTransaction process.
> afterTransaction is split into a number of steps, afterAfterTransaction
> simply being the last step in that process.
>
>
>
> On Wed 18 Jul 2012 05:15:20 AM CDT, Sanne Grinovero wrote:
>>
>> Hi all,
>> I'm puzzled about the implementation we have in
>> org.hibernate.engine.transaction.internal.jta.JtaTransaction
>>
>> regarding after-transaction completion handling.
>>
>> Looking at the two methods:
>> afterAfterCompletion(); <-- note the "After - After" prefix
>> afterTransactionCompletion(int status);
>>
>>
>> The implementation of afterTransactionCompletion(int status) is a
>> no-op, while after-after-completion actually invokes the
>> transactionCoordinator().afterTransaction( this,
>> userTransaction.getStatus() );
>> Shouldn't this be invoked in the afterTransactionCompletion(status)
>> method?
>>
>> As I just noticed in some OGM tests, during the after-after phase it's
>> too late to invoke the getStatus() on the transaction as this will
>> have been cleaned up already: that's why the
>> afterTransactionCompletion(int) has a status parameter, as the status
>> argument should be used rather than attempting to lookup the
>> transaction state again.
>>
>> OGM is having it's own AbstractTransactionImpl implementation;
>> changing it by moving the afterTransaction call in the appropriate
>> method fixed my problems to our Search integration.
>>
>> This looks like a change that should be picked up by ORM's
>> JtaTransaction too? I'm not familiar with this, so I might be totally
>> wrong but in case I would love to understand why.
>>
>> Cheers,
>> Sanne
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
More information about the hibernate-dev
mailing list