diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 832670e75..cdcb78fa6 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -70,7 +70,8 @@ The type attribute can be add,update,fix,remove. - Removed two constructors and two methods from the package-private class CPDSConnectionFactory; this is binary compatible. + Removed two constructors and two methods from the package-private class CPDSConnectionFactory; this is binary compatible. + Removed one constructor and two methods from the package-private class KeyedCPDSConnectionFactory; this is binary compatible. diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java index ba8b1ad79..63c85d6ec 100644 --- a/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java @@ -89,27 +89,6 @@ public KeyedCPDSConnectionFactory(final ConnectionPoolDataSource cpds, final Str this.rollbackAfterValidation = rollbackAfterValidation; } - /** - * Creates a new {@code KeyedPoolableConnectionFactory}. - * - * @param cpds - * the ConnectionPoolDataSource from which to obtain PooledConnections - * @param validationQuery - * a query to use to {@link #validateObject validate} {@link Connection}s. Should return at least one - * row. May be {@code null} in which case3 {@link Connection#isValid(int)} will be used to validate - * connections. - * @param validationQueryTimeoutSeconds - * The time, in seconds, to allow for the validation query to complete - * @param rollbackAfterValidation - * whether a rollback should be issued after {@link #validateObject validating} {@link Connection}s. - * @deprecated Use {@link #KeyedCPDSConnectionFactory(ConnectionPoolDataSource, String, Duration, boolean)}. - */ - @Deprecated - public KeyedCPDSConnectionFactory(final ConnectionPoolDataSource cpds, final String validationQuery, - final int validationQueryTimeoutSeconds, final boolean rollbackAfterValidation) { - this(cpds, validationQuery, Duration.ofSeconds(validationQueryTimeoutSeconds), rollbackAfterValidation); - } - @Override public void activateObject(final UserPassKey key, final PooledObject p) throws SQLException { validateLifetime(p); @@ -273,33 +252,6 @@ public void setMaxConn(final Duration maxConnLifetimeMillis) { this.maxConnDuration = maxConnLifetimeMillis; } - /** - * Sets the maximum lifetime of a connection after which the connection will always fail activation, - * passivation and validation. - * - * @param maxConnLifetimeMillis - * A value of zero or less indicates an infinite lifetime. The default value is -1 milliseconds. - * @since 2.9.0 - * @deprecated Use {@link #setMaxConn(Duration)}. - */ - @Deprecated - public void setMaxConnLifetime(final Duration maxConnLifetimeMillis) { - this.maxConnDuration = maxConnLifetimeMillis; - } - - /** - * Sets the maximum lifetime in milliseconds of a connection after which the connection will always fail activation, - * passivation and validation. - * - * @param maxConnLifetimeMillis - * A value of zero or less indicates an infinite lifetime. The default value is -1. - * @deprecated Use {@link #setMaxConnLifetime(Duration)}. - */ - @Deprecated - public void setMaxConnLifetimeMillis(final long maxConnLifetimeMillis) { - setMaxConn(Duration.ofMillis(maxConnLifetimeMillis)); - } - /** * Does nothing. This factory does not cache user credentials. */ diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java index 73133ccca..3f9070193 100644 --- a/src/test/java/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java +++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java @@ -62,7 +62,7 @@ public void setUp() throws Exception { public void testConnectionErrorCleanup() throws Exception { // Setup factory final UserPassKey key = new UserPassKey("userName", "password"); - final KeyedCPDSConnectionFactory factory = new KeyedCPDSConnectionFactory(cpds, null, -1, false); + final KeyedCPDSConnectionFactory factory = new KeyedCPDSConnectionFactory(cpds, null, Duration.ofSeconds(-1), false); try (final KeyedObjectPool pool = new GenericKeyedObjectPool<>(factory)) { factory.setPool(pool); @@ -123,7 +123,7 @@ public void testConnectionErrorCleanup() throws Exception { @Test public void testNullValidationQuery() throws Exception { final UserPassKey key = new UserPassKey("userName", "password"); - final KeyedCPDSConnectionFactory factory = new KeyedCPDSConnectionFactory(cpds, null, -1, false); + final KeyedCPDSConnectionFactory factory = new KeyedCPDSConnectionFactory(cpds, null, Duration.ofSeconds(-1), false); try (final GenericKeyedObjectPool pool = new GenericKeyedObjectPool<>(factory)) { factory.setPool(pool); pool.setTestOnBorrow(true);