Resource-based PlatformTransactionManager implementations defensively catch Throwable in doBegin in order to reliably close resource in case of OutOfMemoryError
Issue: SPR-10755
This commit is contained in:
@@ -583,7 +583,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
txObject.getSessionHolder().setSynchronizedWithTransaction(true);
|
||||
}
|
||||
|
||||
catch (Exception ex) {
|
||||
catch (Throwable ex) {
|
||||
if (txObject.isNewSession()) {
|
||||
try {
|
||||
if (session.getTransaction().isActive()) {
|
||||
|
||||
@@ -366,7 +366,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
closePersistenceManagerAfterFailedBegin(txObject);
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
catch (Throwable ex) {
|
||||
closePersistenceManagerAfterFailedBegin(txObject);
|
||||
throw new CannotCreateTransactionException("Could not open JDO PersistenceManager for transaction", ex);
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
closeEntityManagerAfterFailedBegin(txObject);
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
catch (Throwable ex) {
|
||||
closeEntityManagerAfterFailedBegin(txObject);
|
||||
throw new CannotCreateTransactionException("Could not open JPA EntityManager for transaction", ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user