LDAP-179: DataSource connections not being released when LDAP connection fails in JDBC integrated transaction.

Now cleaning up in DataSource and Hibernate transaction managers in doBegin if failing to create LDAP transaction.
This commit is contained in:
Mattias Hellborg Arthursson
2013-08-14 12:17:38 +02:00
parent cfabe261e8
commit cc14bf3319
6 changed files with 328 additions and 4 deletions

View File

@@ -77,8 +77,14 @@ public class ContextSourceAndDataSourceTransactionManager extends
super.doBegin(actualTransactionObject.getDataSourceTransactionObject(),
definition);
ldapManagerDelegate.doBegin(actualTransactionObject
.getLdapTransactionObject(), definition);
try {
ldapManagerDelegate.doBegin(actualTransactionObject
.getLdapTransactionObject(), definition);
} catch (TransactionException e) {
// Failed to start LDAP transaction - make sure we clean up properly
super.doCleanupAfterCompletion(actualTransactionObject.getDataSourceTransactionObject());
throw e;
}
}
/*

View File

@@ -76,8 +76,14 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
super.doBegin(actualTransactionObject.getHibernateTransactionObject(),
definition);
ldapManagerDelegate.doBegin(actualTransactionObject
.getLdapTransactionObject(), definition);
try {
ldapManagerDelegate.doBegin(actualTransactionObject
.getLdapTransactionObject(), definition);
} catch (TransactionException e) {
// Failed to start LDAP transaction - make sure we clean up properly
super.doCleanupAfterCompletion(actualTransactionObject.getHibernateTransactionObject());
throw e;
}
}
/*