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