Apache Commons DBCP 的 documentation状态,即
defaultQueryTimeout
If non-null, the value of this Integer property determines the query timeout that will be used for Statements created from connections managed by the pool. null means that the driver default will be used.
但他们忘记提及他们期望的[时间]单位。 Javadoc 中也存在同样的健忘情况。
我假设超时以秒为单位,因为 validationQueryTimeout
期望超时以秒为单位,但这只是一个假设。
那么什么单位适用于 defaultQueryTimeout
?还秒?
最佳答案
这两个值的有效单位是秒。
所需信息可在类 BasicDataSource 的 Javadoc 中找到。
getDefaultQueryTimeout
[***]
Returns:
The default query timeout in seconds.
getValidationQueryTimeout
[***]
Returns:
the timeout in seconds before connection validation queries fail.
您还可以阅读 source code of this class了解更多信息
关于java - Apache DBCP defaultQueryTimeout 需要哪些单位?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60186821/