本文主要是介绍HikariCP closes connections in five cases,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
HikariCP determined that the connection was dead, i.e. (connection is evicted or dead)
, and therefore attempted to close it. The driver then said, “Sorry the connection is already closed”, which is not unexpected.
You might think, “Why do you need to close a dead connection?” Well, maybe it was only temporarily unavailable (or slow) so the validation test failed, but the connection is still “alive” from the driver’s perspective. Closing, or at least attempting to, is essential to allow the driver opportunity to cleanup resources.
HikariCP closes connections in five cases:
- The connection failed validation. This is invisible to your application. The connection is retired and replaced. You would see a log message to the effect of
Failed to validate connection....
- A connection was idle for longer than idleTimeout. This is invisible to your application. The connection is retired and replaced. You would see a closure reason of
(connection has passed idleTimeout)
.- A connection reached its maxLifetime. This is invisible to your application. The connection is retired and replaced. You would see a closure reason of
(connection has passed maxLifetime)
, or if the connection is in use at the time of reaching maxLifetime you would see (connection is evicted or dead) at a later time.- The user manually evicted a connection. This is invisible to your application. The connection is retired and replaced. You would see a closure reason of
(connection evicted by user)
.- A JDBC call threw an unrecoverable SQLException. This should be visible to your application. You would see a closure reason of
(connection is broken)
.
这篇关于HikariCP closes connections in five cases的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!