HHH-12540 - Reusing same EntityTransaction with JTA enabled
This commit is contained in:
parent
ca86633370
commit
ecd6f503f8
|
@ -212,6 +212,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator) {
|
protected void removeSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator) {
|
||||||
|
transactionCoordinator.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2741,6 +2741,7 @@ public final class SessionImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void removeSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator) {
|
protected void removeSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator) {
|
||||||
|
super.removeSharedSessionTransactionObserver( transactionCoordinator );
|
||||||
transactionCoordinator.removeObserver( transactionObserver );
|
transactionCoordinator.removeObserver( transactionObserver );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,6 @@ public class JtaTransactionCoordinatorImpl implements TransactionCoordinator, Sy
|
||||||
synchronizationRegistered = false;
|
synchronizationRegistered = false;
|
||||||
|
|
||||||
pulse();
|
pulse();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -337,6 +336,14 @@ public class JtaTransactionCoordinatorImpl implements TransactionCoordinator, Sy
|
||||||
return this.timeOut;
|
return this.timeOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidate() {
|
||||||
|
if ( physicalTransactionDelegate != null ) {
|
||||||
|
physicalTransactionDelegate.invalidate();
|
||||||
|
}
|
||||||
|
physicalTransactionDelegate = null;
|
||||||
|
}
|
||||||
|
|
||||||
// SynchronizationCallbackTarget ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// SynchronizationCallbackTarget ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -377,11 +384,6 @@ public class JtaTransactionCoordinatorImpl implements TransactionCoordinator, Sy
|
||||||
observer.afterCompletion( successful, delayed );
|
observer.afterCompletion( successful, delayed );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( physicalTransactionDelegate != null ) {
|
|
||||||
physicalTransactionDelegate.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
physicalTransactionDelegate = null;
|
|
||||||
synchronizationRegistered = false;
|
synchronizationRegistered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +396,6 @@ public class JtaTransactionCoordinatorImpl implements TransactionCoordinator, Sy
|
||||||
observers.remove( observer );
|
observers.remove( observer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the LocalInflow for this TransactionCoordinator. Allows the
|
* Implementation of the LocalInflow for this TransactionCoordinator. Allows the
|
||||||
* local transaction ({@link org.hibernate.Transaction} to callback into this
|
* local transaction ({@link org.hibernate.Transaction} to callback into this
|
||||||
|
|
|
@ -106,6 +106,8 @@ public interface TransactionCoordinator {
|
||||||
return isJoined() && getTransactionDriverControl().isActive( isMarkedRollbackConsideredActive );
|
return isJoined() && getTransactionDriverControl().isActive( isMarkedRollbackConsideredActive );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default void invalidate(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the means for "local transactions" (as transaction drivers) to control the
|
* Provides the means for "local transactions" (as transaction drivers) to control the
|
||||||
* underlying "physical transaction" currently associated with the TransactionCoordinator.
|
* underlying "physical transaction" currently associated with the TransactionCoordinator.
|
||||||
|
|
Loading…
Reference in New Issue