Register transaction coordinator as observer when session is waiting for auto close but coordinator is not shared
This commit is contained in:
parent
9f460e1c30
commit
ffe45ccdd6
|
@ -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;
|
||||
|
|
|
@ -377,8 +377,7 @@ public class SessionImpl
|
|||
}
|
||||
else {
|
||||
//Otherwise, session auto-close will be enabled by shouldAutoCloseSession().
|
||||
waitingForAutoClose = true;
|
||||
closed = true;
|
||||
prepareForAutoClose();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue