Consistent reset of resource holders on doBegin failure

Issue: SPR-12280
(cherry picked from commit 9758bc7)
This commit is contained in:
Juergen Hoeller
2014-10-07 00:06:49 +02:00
parent 6183e83b6a
commit 76ab5b9de2
7 changed files with 72 additions and 59 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -124,7 +124,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
protected Object doGetTransaction() {
CciLocalTransactionObject txObject = new CciLocalTransactionObject();
ConnectionHolder conHolder =
(ConnectionHolder) TransactionSynchronizationManager.getResource(getConnectionFactory());
(ConnectionHolder) TransactionSynchronizationManager.getResource(getConnectionFactory());
txObject.setConnectionHolder(conHolder);
return txObject;
}
@@ -157,7 +157,6 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
}
TransactionSynchronizationManager.bindResource(getConnectionFactory(), txObject.getConnectionHolder());
}
catch (NotSupportedException ex) {
ConnectionFactoryUtils.releaseConnection(con, getConnectionFactory());
throw new CannotCreateTransactionException("CCI Connection does not support local transactions", ex);
@@ -266,7 +265,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
}
public ConnectionHolder getConnectionHolder() {
return connectionHolder;
return this.connectionHolder;
}
}