Skip to content

Commit

Permalink
Removed one constructors and two methods from the package-private class
Browse files Browse the repository at this point in the history
KeyedCPDSConnectionFactory; this is binary compatible
  • Loading branch information
garydgregory committed Dec 15, 2024
1 parent 5e05880 commit 82c4020
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 51 deletions.
3 changes: 2 additions & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ The <action> type attribute can be add,update,fix,remove.
<!-- ADD -->
<!-- UPDATE -->
<!-- REMOVE -->
<action type="remove" dev="ggregory" due-to="Gary Gregory">Removed two constructors and two methods from the package-private class CPDSConnectionFactory; this is binary compatible.</action>
<action type="remove" dev="ggregory" due-to="Gary Gregory">Removed two constructors and two methods from the package-private class CPDSConnectionFactory; this is binary compatible.</action>
<action type="remove" dev="ggregory" due-to="Gary Gregory">Removed one constructor and two methods from the package-private class KeyedCPDSConnectionFactory; this is binary compatible.</action>
</release>
<release version="2.13.0" date="2024-11-23" description="This is a minor release, including bug fixes and enhancements.">
<!-- FIX -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PooledConnectionAndInfo> p) throws SQLException {
validateLifetime(p);
Expand Down Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserPassKey, PooledConnectionAndInfo> pool = new GenericKeyedObjectPool<>(factory)) {
factory.setPool(pool);

Expand Down Expand Up @@ -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<UserPassKey, PooledConnectionAndInfo> pool = new GenericKeyedObjectPool<>(factory)) {
factory.setPool(pool);
pool.setTestOnBorrow(true);
Expand Down

0 comments on commit 82c4020

Please sign in to comment.