brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.63k stars 2.9k forks source link

Introduce Extension Point To Force Eviction #2184

Open rreich opened 4 months ago

rreich commented 4 months ago

With the SQLExceptionOverride it is already possible to prevent the eviction of a connection. What we are missing is the opposite: Force the eviction based on an SQLException that would by default not trigger an eviction.

While it would probably be possible to make the ERROR_STATES and ERROR_CODES configurable, it would probably make more sense to have a feature like the SQLExceptionOverride or even extend the existing feature by moving the call of SQLExceptionOverride#adjudicate up, out of the surrounding if and adding a FORCE_EVICT entry to the enum.

Another suggestion from an existing issue was to allow overriding the complete checkException(SQLException) method, but I guess that would be harder to use and would be another different concept for a very similar use-case. See https://github.com/brettwooldridge/HikariCP/issues/2015

Original use-case: https://github.com/brettwooldridge/HikariCP/issues/2185