From a9a8ecb22122e3cc01518c8e896e51af02851558 Mon Sep 17 00:00:00 2001 From: Brett Meyer Date: Thu, 14 Mar 2013 11:57:32 -0400 Subject: [PATCH] HHH-7910 Corrected thread checking logic --- .../internal/SynchronizationCallbackCoordinatorImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/synchronization/internal/SynchronizationCallbackCoordinatorImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/synchronization/internal/SynchronizationCallbackCoordinatorImpl.java index cd3e6bf663..6f3de2c254 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/synchronization/internal/SynchronizationCallbackCoordinatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/synchronization/internal/SynchronizationCallbackCoordinatorImpl.java @@ -127,10 +127,8 @@ public class SynchronizationCallbackCoordinatorImpl implements SynchronizationCa } public void afterCompletion(int status) { - if ( !settings.isJtaTrackByThread() || isRegistrationThread() ) { - doAfterCompletion( status ); - } - else if ( JtaStatusHelper.isRollback( status ) ) { + if ( settings.isJtaTrackByThread() && !isRegistrationThread() + && JtaStatusHelper.isRollback( status ) ) { // The transaction was rolled back by another thread -- not the // original application. Examples of this include a JTA transaction // timeout getting cleaned up by a reaper thread. If this happens, @@ -140,6 +138,9 @@ public class SynchronizationCallbackCoordinatorImpl implements SynchronizationCa LOG.warnv( "Transaction afterCompletion called by a background thread! Delaying action until the original thread can handle it. [status={0}]", status ); delayedCompletionHandlingStatus = status; } + else { + doAfterCompletion( status ); + } } public void pulse() {