Consistent reset of resource holders on doBegin failure
Issue: SPR-12280
This commit is contained in:
@@ -178,6 +178,7 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
|
||||
if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
|
||||
throw new InvalidIsolationLevelException("JMS does not support an isolation level concept");
|
||||
}
|
||||
|
||||
JmsTransactionObject txObject = (JmsTransactionObject) transaction;
|
||||
Connection con = null;
|
||||
Session session = null;
|
||||
@@ -193,10 +194,17 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
|
||||
if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) {
|
||||
txObject.getResourceHolder().setTimeoutInSeconds(timeout);
|
||||
}
|
||||
TransactionSynchronizationManager.bindResource(
|
||||
getConnectionFactory(), txObject.getResourceHolder());
|
||||
TransactionSynchronizationManager.bindResource(getConnectionFactory(), txObject.getResourceHolder());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
if (session != null) {
|
||||
try {
|
||||
session.close();
|
||||
}
|
||||
catch (Throwable ex2) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (con != null) {
|
||||
try {
|
||||
con.close();
|
||||
|
||||
Reference in New Issue
Block a user