brettwooldridge / HikariCP

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

The best approach to memorizing thread names on each acquisition and release of connection. #2119

Closed setofaces closed 8 months ago

setofaces commented 9 months ago

Hello there. I am kind of confused how can I achieve memorizing of thread names getting and releasing connections: First part is not so hard, just wrapper around DataSource with overridden getConnection method which put thread name in a Collection when delegating to actual DataSource, something like this snippet concept-wise

The problem arises when it comes to the removing of thread name from a Collection on release: the only probably possible way is to do some AOP-magic with PoolEntry release method for me atm. Are there any existing workarounds or ideas, guys?

setofaces commented 8 months ago

One of the possible solutions might be https://github.com/jdbc-observations/datasource-proxy/ but not sure about exceptions case