Java 连接池 Apache Commons DBCP 2.9.0 发布
Apache Commons DBCP 2.9.0 现已发布,这是一个次要版本,主要包含 bug 修复和改进。DBCP(Database Connection Pool)是一个依赖 Jakarta commons-pool 对象池机制的数据库连接池,Tomcat 的数据源使用的就是 DBCP。 主要更新内容 添加并重新使用Constants.KEY_USER 和 Constants.KEY_PASSWORD 添加并重新使用 DriverAdapterCPDS.{get|set}DurationBetweenEvictionRuns(),弃用 {get|set}TimeBetweenEvictionRunsMillis(long) 修复 TestSynchronizationOrder.testInterposedSynchronization 上的测试随机失败 ManagedConnection 必须在事务完成后清除其缓存状态 使用 abort 而不是 close 来清理废弃的连接 性能增强:以零数组大小调用 toArray 避免由于 JMX 暴露密码 DataSource 实现没有正确实现 Wrapper 接口 DataSourceConnectionFactory.getUserPassword() 可以通过返回 DataSourceConnectionFactory.userPassword 来暴露内部表示 使用 Collections.synchronizedList() 而不是 Vector 更新 PoolKey#toString() 以避免泄露用户名 内部包私有 UserPassKey 类将其用户名存储为 char[] BasicDataSource 应该动态测试安全管理器的存在,而不是在初始化时测试一次 详情请查看更新公告。