⭐⭐⭐ Spring Boot 项目实战 ⭐⭐⭐ Spring Cloud 项目实战
《Dubbo 实现原理与源码解析 —— 精品合集》 《Netty 实现原理与源码解析 —— 精品合集》
《Spring 实现原理与源码解析 —— 精品合集》 《MyBatis 实现原理与源码解析 —— 精品合集》
《Spring MVC 实现原理与源码解析 —— 精品合集》 《数据库实体设计合集》
《Spring Boot 实现原理与源码解析 —— 精品合集》 《Java 面试题 + Java 学习指南》

摘要: 原创出处 https://mp.weixin.qq.com/s/VLtUhY1E4Pz4oS-BeAnOjg 「渣渣王子」欢迎转载,保留摘要,谢谢!


🙂🙂🙂关注**微信公众号:【芋道源码】**有福利:

  1. RocketMQ / MyCAT / Sharding-JDBC 所有源码分析文章列表
  2. RocketMQ / MyCAT / Sharding-JDBC 中文注释源码 GitHub 地址
  3. 您对于源码的疑问每条留言将得到认真回复。甚至不知道如何读源码也可以请教噢
  4. 新的源码解析文章实时收到通知。每周更新一篇左右
  5. 认真的源码交流微信群。

可能欠妥的升级

最近很多业务方找我咨询hikariCP 3.0.0的问题,比如shutdown方法没了之类,毕竟我前段时间还在研究2.6.2~2.7.8版本的源码,很感兴趣翻了一下,翻完之后发现居然升级到3.1.0版本的。

我们可以看一下changenote

HikariCP Changes

Changes in 3.1.0

  • Add get/setCatalog() to HikariConfigMXBean, allowing the catalog to be changed at runtime. The catalog should only be changed while the pool is suspended, and after evicting existing connections via HikariPoolMXBean.softEvictConnections().

Changes in 3.0.0

  • Removed previously deprecated methods; HikariConfig.copyState() HikariConfig.getScheduledExecutorService() HikariConfig.setScheduledExecutorService() HikariConfig.isInitializationFailFast() HikariConfig.setInitializationFailFast() HikariConfig.isJdbc4ConnectionTest() HikariConfig.setJdbc4ConnectionTest()

    HikariDataSource.copyState() HikariDataSource.getScheduledExecutorService() HikariDataSource.setScheduledExecutorService() HikariDataSource.suspendPool() HikariDataSource.resumePool() HikariDataSource.shutdown() HikariDataSource.isInitializationFailFast() HikariDataSource.setInitializationFailFast() HikariDataSource.isJdbc4ConnectionTest() HikariDataSource.setJdbc4ConnectionTest()

  • pull 1110 add currently configured maxConnections and minConnections to pool metrics.

  • pull 1100 remove hard-coded percentiles for Micrometer metrics.

  • pull 1108 maintain a strong reference to PoolStats for Micrometer gauges to prevent premature garbage collection.

  • pull 1098 update to Micrometer 1.0.0.

Changes in 2.7.8

  • fixed 1095 fix breakage caused by sealed configuration with respect to special handling for the metricsRegistry and metricsTrackerFactory properties, which are allowed to be altered once after the pool has started (even after the configuration is sealed).
  • pull 1089 allowing anonymous subclasses of MetricRegistry. Changed checks for metrics libraries from a class name check to the assignableFrom() API.

Changes in 2.7.7

  • fixed issue whereby configuration through the HikariConfigMXBean could not be altered due to the sealed configuration change introduced in 2.7.5.

Changes in 2.7.6

  • issue 1064 fixed regression where HikariConfig.copyStateTo() propagated the "sealed" status of the source configuration to the target configuration -- preventing further changes.

一般来说,连续两次大版本升级,应该是比较大的改变,大版本更新只是删除了几个废弃方法,另外MXbean的鸡肋功能也升了一个中版本。连接池就是要大道至简的,我个人觉得即使作者没啥可更新的了,作为开源软件或中间件的开发最好不要这么冲动升级版本的。

作者详细资料梳理

https://twitter.com/BrettWooldridge

https://github.com/brettwooldridge

https://stackoverflow.com/users/431356/brettw

https://blog.jooq.org/2017/02/21/jooq-tuesdays-brett-wooldridge-shows-what-it-takes-to-write-the-fastest-java-connection-pool/

666. 彩蛋

如果你对 HikariCP 感兴趣,欢迎加入我的知识星球一起交流。

知识星球

文章目录
  1. 1. 可能欠妥的升级
  2. 2. 作者详细资料梳理
  3. 3. 666. 彩蛋