Register transaction coordinator as observer when session is waiting for auto close but coordinator is not shared

This commit is contained in:
Christian Beikov 2021-02-03 11:19:46 +01:00
parent 9f460e1c30
commit ffe45ccdd6
2 changed files with 10 additions and 2 deletions

View File

@ -240,6 +240,15 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
transactionCoordinator.invalidate();
}
protected void prepareForAutoClose() {
waitingForAutoClose = true;
closed = true;
// For non-shared transaction coordinators, we have to add the observer
if ( !isTransactionCoordinatorShared ) {
addSharedSessionTransactionObserver( transactionCoordinator );
}
}
@Override
public boolean shouldAutoJoinTransaction() {
return autoJoinTransactions;

View File

@ -377,8 +377,7 @@ public class SessionImpl
}
else {
//Otherwise, session auto-close will be enabled by shouldAutoCloseSession().
waitingForAutoClose = true;
closed = true;
prepareForAutoClose();
}
}
else {