Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooking the connection.close() call #2169

Open
valley-fordham opened this issue Feb 9, 2024 · 1 comment
Open

Hooking the connection.close() call #2169

valley-fordham opened this issue Feb 9, 2024 · 1 comment

Comments

@valley-fordham
Copy link

valley-fordham commented Feb 9, 2024

I currently have some logic that occurs when retrieving a database connection from a wrapper class on HikariDataSource, and I'd like to rollback those changes by hooking the indirect calls to .close() we make on the connection using try-with-resources.

Is there an easy way to provide a callback which can do this, without building a new connection wrapper around the Hikari connection? I can't see any documentation to this end but I may have missed it.

Happy to provide a code snippet if I'm not making sense.

@valley-fordham
Copy link
Author

To expand further, I've looked into doing this by using a wrapper and it seems that the close method on the abstract ProxyConnection is final, so I can't override it without using unsafe methods, as far as I can see. Open to ideas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant