Fix connection leak in connection provider used for JTA tests
This commit is contained in:
parent
a8cddb93e8
commit
62d727d44e
|
@ -93,10 +93,15 @@ public class JtaAwareConnectionProviderImpl implements ConnectionProvider, Confi
|
|||
if ( connection == null ) {
|
||||
connection = delegate.getConnection();
|
||||
TestingJtaPlatformImpl.synchronizationRegistry().putResource( CONNECTION_KEY, connection );
|
||||
|
||||
try {
|
||||
XAResourceWrapper xaResourceWrapper = new XAResourceWrapper( this, connection );
|
||||
currentTransaction.enlistResource( xaResourceWrapper );
|
||||
}
|
||||
catch (Exception e) {
|
||||
delist( connection );
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
catch (SQLException e) {
|
||||
|
|
Loading…
Reference in New Issue