修复Druid连接池无法设置部分属性问题

This commit is contained in:
Looly 2024-01-02 13:21:56 +08:00
parent da276f801c
commit 3b484fdbf7
2 changed files with 34 additions and 1 deletions

View File

@ -2,7 +2,7 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.25(2023-12-29)
# 5.8.25(2024-01-02)
### 🐣新特性
* 【core 】 WatchServer新增通过Path获取WatchKey方法pr#1145@Gitee
@ -11,6 +11,7 @@
* 【core 】 修复StrJoin当append内容后调用length()会出现空指针问题issue#3444@Github
* 【core 】 修复PostgreSQL、H2使用upsert字段大小写问题issue#I8PB4X@Gitee
* 【core 】 修复RandomUtil.randomInt,RandomUtil.randomLong边界问题pr#3450@Github
* 【db 】 修复Druid连接池无法设置部分属性问题issue#I8STFC@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.8.24(2023-12-23)

View File

@ -77,6 +77,38 @@ public class DruidDSFactory extends AbstractDSFactory {
ds.setBreakAfterAcquireFailure(druidProps.getBool(breakAfterAcquireFailureKey));
}
// issue#I8STFC 补充
// validationQueryTimeout
final String validationQueryTimeout = "druid.validationQueryTimeout";
if(druidProps.containsKey(validationQueryTimeout)){
ds.setValidationQueryTimeout(druidProps.getInt(validationQueryTimeout));
}
// queryTimeout
final String queryTimeout = "druid.queryTimeout";
if(druidProps.containsKey(queryTimeout)){
ds.setQueryTimeout(druidProps.getInt(queryTimeout));
}
// connectTimeout
final String connectTimeout = "druid.connectTimeout";
if(druidProps.containsKey(connectTimeout)){
ds.setConnectTimeout(druidProps.getInt(connectTimeout));
}
// socketTimeout
final String socketTimeout = "druid.socketTimeout";
if(druidProps.containsKey(socketTimeout)){
ds.setSocketTimeout(druidProps.getInt(socketTimeout));
}
// transactionQueryTimeout
final String transactionQueryTimeout = "druid.transactionQueryTimeout";
if(druidProps.containsKey(transactionQueryTimeout)){
ds.setTransactionQueryTimeout(druidProps.getInt(transactionQueryTimeout));
}
// loginTimeout
final String loginTimeout = "druid.loginTimeout";
if(druidProps.containsKey(loginTimeout)){
ds.setLoginTimeout(druidProps.getInt(loginTimeout));
}
// 检查关联配置在用户未设置某项配置时设置默认值
if (null == ds.getValidationQuery()) {
// 在validationQuery未设置的情况下以下三项设置都将无效