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 7f418833 Update call sites of deprecated APIs from Apache Commons Pool
7f418833 is described below
commit 7f418833add9fc0fea334e47633821791ee96c6b
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Oct 23 12:31:39 2023 -0400
Update call sites of deprecated APIs from Apache Commons Pool
---
src/changes/changes.xml | 1 +
.../java/org/apache/commons/dbcp2/BasicDataSource.java | 14 +++++++-------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4f432739..eebd8587 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,6 +64,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="2.11.0" date="20YY-MM-DD" description="This is a minor
release, including bug fixes and enhancements.">
<!-- FIX -->
+ <action type="update" dev="ggregory" due-to="Gary Gregory">Update call
sites of deprecated APIs from Apache Commons Pool.</action>
<!-- ADD -->
<action type="update" dev="ggregory" due-to="Gary Gregory,
Dependabot">Add DataSourceMXBean.getUserName() and deprecate
getUsername().</action>
<!-- UDPATE -->
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index d3b1799c..f07496c3 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -257,7 +257,7 @@ public class BasicDataSource implements DataSource,
BasicDataSourceMXBean, MBean
* The number of milliseconds to sleep between runs of the idle object
evictor thread. When non-positive, no idle
* object evictor thread will be run.
*/
- private Duration durationBetweenEvictionRuns =
BaseObjectPoolConfig.DEFAULT_TIME_BETWEEN_EVICTION_RUNS;
+ private Duration durationBetweenEvictionRuns =
BaseObjectPoolConfig.DEFAULT_DURATION_BETWEEN_EVICTION_RUNS;
/**
* The number of objects to examine during each run of the idle object
evictor thread (if any).
@@ -493,8 +493,8 @@ public class BasicDataSource implements DataSource,
BasicDataSourceMXBean, MBean
gop.setTestOnBorrow(testOnBorrow);
gop.setTestOnReturn(testOnReturn);
gop.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
- gop.setMinEvictableIdle(minEvictableIdleDuration);
- gop.setSoftMinEvictableIdle(softMinEvictableIdleDuration);
+ gop.setMinEvictableIdleDuration(minEvictableIdleDuration);
+ gop.setSoftMinEvictableIdleDuration(softMinEvictableIdleDuration);
gop.setTestWhileIdle(testWhileIdle);
gop.setLifo(lifo);
gop.setSwallowedExceptionListener(new SwallowedExceptionLogger(log,
logExpiredConnections));
@@ -2030,7 +2030,7 @@ public class BasicDataSource implements DataSource,
BasicDataSourceMXBean, MBean
*/
public synchronized void setDurationBetweenEvictionRuns(final Duration
timeBetweenEvictionRunsMillis) {
this.durationBetweenEvictionRuns = timeBetweenEvictionRunsMillis;
- setConnectionPool(GenericObjectPool::setTimeBetweenEvictionRuns,
timeBetweenEvictionRunsMillis);
+ setConnectionPool(GenericObjectPool::setDurationBetweenEvictionRuns,
timeBetweenEvictionRunsMillis);
}
/**
@@ -2262,7 +2262,7 @@ public class BasicDataSource implements DataSource,
BasicDataSourceMXBean, MBean
*/
public synchronized void setMinEvictableIdle(final Duration
minEvictableIdleDuration) {
this.minEvictableIdleDuration = minEvictableIdleDuration;
- setConnectionPool(GenericObjectPool::setMinEvictableIdle,
minEvictableIdleDuration);
+ setConnectionPool(GenericObjectPool::setMinEvictableIdleDuration,
minEvictableIdleDuration);
}
/**
@@ -2413,7 +2413,7 @@ public class BasicDataSource implements DataSource,
BasicDataSourceMXBean, MBean
*/
public synchronized void setSoftMinEvictableIdle(final Duration
softMinEvictableIdleTimeMillis) {
this.softMinEvictableIdleDuration = softMinEvictableIdleTimeMillis;
- setConnectionPool(GenericObjectPool::setSoftMinEvictableIdle,
softMinEvictableIdleTimeMillis);
+ setConnectionPool(GenericObjectPool::setSoftMinEvictableIdleDuration,
softMinEvictableIdleTimeMillis);
}
/**
@@ -2590,7 +2590,7 @@ public class BasicDataSource implements DataSource,
BasicDataSourceMXBean, MBean
*/
protected void startPoolMaintenance() {
if (connectionPool != null &&
durationBetweenEvictionRuns.compareTo(Duration.ZERO) > 0) {
-
connectionPool.setTimeBetweenEvictionRuns(durationBetweenEvictionRuns);
+
connectionPool.setDurationBetweenEvictionRuns(durationBetweenEvictionRuns);
}
}