This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit aff8a087d20d458c3a8c416d3c5f037815c10832 Author: opencode <[email protected]> AuthorDate: Tue Dec 1 23:32:43 2026 +0100 Document live URL and data source change scope Clarify that changing the URL or backing data source on a running pool applies only to connections established afterwards. Existing idle and in-use pooled connections keep their current session until evicted, expired, or re-established for another reason. mvn test passes: 1187 tests, 0 failures. --- .../java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java | 14 ++++++++++++++ .../org/apache/tomcat/jdbc/pool/PoolConfiguration.java | 10 +++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java index c5b2dca338..40fb4b421b 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java @@ -843,6 +843,13 @@ public class DataSourceProxy implements PoolConfiguration { } + /** + * Sets the URL used to connect to the database. Only connections established from now on use the new URL: an + * existing idle or in-use pooled connection keeps the session it already holds until it is evicted, expires, or is + * re-established for another reason. {@inheritDoc} + * + * @param url the configured URL for this connection pool + */ @Override public void setUrl(String url) { this.poolProperties.setUrl(url); @@ -1698,6 +1705,13 @@ public class DataSourceProxy implements PoolConfiguration { getPoolProperties().setName(name); } + /** + * Sets the backing data source. Only connections established from now on use the new provider: an existing idle or + * in-use pooled connection keeps the session it already holds until it is evicted, expires, or is re-established + * for another reason. {@inheritDoc} + * + * @param ds the data source to use for creating connections to be pooled + */ @Override public void setDataSource(Object ds) { getPoolProperties().setDataSource(ds); diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java index 3cdae098ee..8f51b0de4f 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java @@ -666,7 +666,11 @@ public interface PoolConfiguration { String getUrl(); /** - * Sets the URL used to connect to the database + * Sets the URL used to connect to the database. + * <p> + * A change on a running pool applies to connections established from then on. An existing idle or in-use pooled + * connection keeps the session it already holds until that connection is evicted, expires, or is re-established for + * another reason; changing the URL does not move those sessions to the new database. * * @param url the configured URL for this connection pool * @@ -1037,6 +1041,10 @@ public interface PoolConfiguration { * credentials, or configure neither so the provider's no-argument method and its own defaults are used. A provider * that treats a null password as an empty password rather than its configured default can also authenticate * differently than the pool configuration suggests. + * <p> + * A change on a running pool applies to connections established from then on. An existing idle or in-use pooled + * connection keeps the session it already holds until that connection is evicted, expires, or is re-established for + * another reason; changing the data source does not move those sessions to the new provider. * * @param ds the {@link javax.sql.DataSource} to be used for creating connections to be pooled. */ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
