You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/06/13 17:29:05 UTC
[43/50] [abbrv] commons-dbcp git commit: Specify the scale in the
name of variable for the query timeout.
Specify the scale in the name of variable for the query timeout.
Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/f283f4c4
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/f283f4c4
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/f283f4c4
Branch: refs/heads/release
Commit: f283f4c4b6183504135a98a3e0d77eb89f391bcf
Parents: 7908328
Author: Gary Gregory <ga...@gmail.com>
Authored: Tue Jun 12 08:25:29 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Tue Jun 12 08:25:29 2018 -0600
----------------------------------------------------------------------
.../commons/dbcp2/DelegatingConnection.java | 4 ++--
.../commons/dbcp2/PoolableConnection.java | 20 ++++++++++----------
.../datasources/CPDSConnectionFactory.java | 8 ++++----
3 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/f283f4c4/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
index e4280b2..d6db252 100644
--- a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
@@ -854,12 +854,12 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
}
@Override
- public boolean isValid(final int timeout) throws SQLException {
+ public boolean isValid(final int timeoutSeconds) throws SQLException {
if (isClosed()) {
return false;
}
try {
- return connection.isValid(timeout);
+ return connection.isValid(timeoutSeconds);
} catch (final SQLException e) {
handleException(e);
return false;
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/f283f4c4/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
index 6658cae..a369f05 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
@@ -252,22 +252,22 @@ public class PoolableConnection extends DelegatingConnection<Connection> impleme
* </ol>
*
* @param sql
- * validation query
- * @param timeout
- * validation timeout
+ * The validation SQL query.
+ * @param timeoutSeconds
+ * The validation timeout in seconds.
* @throws SQLException
- * if validation fails or an SQLException occurs during validation
+ * Thrown when validation fails or an SQLException occurs during validation
*/
- public void validate(final String sql, int timeout) throws SQLException {
+ public void validate(final String sql, int timeoutSeconds) throws SQLException {
if (fastFailValidation && fatalSqlExceptionThrown) {
throw new SQLException(Utils.getMessage("poolableConnection.validate.fastFail"));
}
if (sql == null || sql.length() == 0) {
- if (timeout < 0) {
- timeout = 0;
+ if (timeoutSeconds < 0) {
+ timeoutSeconds = 0;
}
- if (!isValid(timeout)) {
+ if (!isValid(timeoutSeconds)) {
throw new SQLException("isValid() returned false");
}
return;
@@ -280,8 +280,8 @@ public class PoolableConnection extends DelegatingConnection<Connection> impleme
validationPreparedStatement = getInnermostDelegateInternal().prepareStatement(sql);
}
- if (timeout > 0) {
- validationPreparedStatement.setQueryTimeout(timeout);
+ if (timeoutSeconds > 0) {
+ validationPreparedStatement.setQueryTimeout(timeoutSeconds);
}
try (ResultSet rs = validationPreparedStatement.executeQuery()) {
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/f283f4c4/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java
index d6aa18a..f0ae74d 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java
@@ -192,13 +192,13 @@ class CPDSConnectionFactory
Connection conn = null;
validatingSet.add(pconn);
if (null == validationQuery) {
- int timeout = validationQueryTimeoutSeconds;
- if (timeout < 0) {
- timeout = 0;
+ int timeoutSeconds = validationQueryTimeoutSeconds;
+ if (timeoutSeconds < 0) {
+ timeoutSeconds = 0;
}
try {
conn = pconn.getConnection();
- valid = conn.isValid(timeout);
+ valid = conn.isValid(timeoutSeconds);
} catch (final SQLException e) {
valid = false;
} finally {