This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
The following commit(s) were added to refs/heads/master by this push: new 9480a5d [DBCP-564] Fix BasicManagedDataSource leak of connections opened after transaction is rollback-only #39. 9480a5d is described below commit 9480a5da8f553d351f744ac3d98287cbd97e1b85 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu May 14 10:24:23 2020 -0400 [DBCP-564] Fix BasicManagedDataSource leak of connections opened after transaction is rollback-only #39. --- src/changes/changes.xml | 5 ++++- .../commons/dbcp2/managed/LocalXAConnectionFactory.java | 17 +++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3c2d1e8..b55dd81 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -60,7 +60,7 @@ The <action> type attribute can be add,update,fix,remove. --> <body> - <release version="2.7.1" date="2019-MM-DD" description="This is a minor release, including bug fixes and enhancements."> + <release version="2.8.0" date="2019-MM-DD" description="This is a minor release, including bug fixes and enhancements."> <!-- fix --> <action dev="ggregory" type="fix" issue="DBCP-555" due-to="Gary Gregory"> NPE when creating a SQLExceptionList with a null list. @@ -83,6 +83,9 @@ The <action> type attribute can be add,update,fix,remove. <action dev="ggregory" type="update" due-to="Gary Gregory"> Update tests from junit-jupiter 5.5.1 to 5.5.2. </action> + <action dev="ggregory" type="add" issue="DBCP-564" due-to="Gary Gregory"> + Fix BasicManagedDataSource leak of connections opened after transaction is rollback-only #39. + </action> </release> <release version="2.7.0" date="2019-07-31" description="This is a minor release, including bug fixes and enhancements."> <!-- add --> diff --git a/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java index 50e9f91..5783083 100644 --- a/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java @@ -311,18 +311,12 @@ public class LocalXAConnectionFactory implements XAConnectionFactory { * * @param transactionManager * the transaction manager in which connections will be enlisted - * @param transactionSynchronizationRegistry - * the optional TSR to register synchronizations with * @param connectionFactory * the connection factory from which connections will be retrieved */ public LocalXAConnectionFactory(final TransactionManager transactionManager, - final TransactionSynchronizationRegistry transactionSynchronizationRegistry, final ConnectionFactory connectionFactory) { - Objects.requireNonNull(transactionManager, "transactionManager is null"); - Objects.requireNonNull(connectionFactory, "connectionFactory is null"); - this.transactionRegistry = new TransactionRegistry(transactionManager, transactionSynchronizationRegistry); - this.connectionFactory = connectionFactory; + this(transactionManager, null, connectionFactory); } /** @@ -331,12 +325,19 @@ public class LocalXAConnectionFactory implements XAConnectionFactory { * * @param transactionManager * the transaction manager in which connections will be enlisted + * @param transactionSynchronizationRegistry + * the optional TSR to register synchronizations with * @param connectionFactory * the connection factory from which connections will be retrieved + * @since 2.8.0 */ public LocalXAConnectionFactory(final TransactionManager transactionManager, + final TransactionSynchronizationRegistry transactionSynchronizationRegistry, final ConnectionFactory connectionFactory) { - this(transactionManager, null, connectionFactory); + Objects.requireNonNull(transactionManager, "transactionManager is null"); + Objects.requireNonNull(connectionFactory, "connectionFactory is null"); + this.transactionRegistry = new TransactionRegistry(transactionManager, transactionSynchronizationRegistry); + this.connectionFactory = connectionFactory; } @Override