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

Add Lifecycle extension #235

Merged
merged 1 commit into from Jul 9, 2021
Merged

Add Lifecycle extension #235

merged 1 commit into from Jul 9, 2021

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Jul 2, 2021

Lifecycle allows Connections to be notified before and after their usage.

Lifecycle allows Connections to be notified before and after their usage.

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
@elefeint
Copy link
Contributor

elefeint commented Jul 2, 2021

This is great. It might make sense for other objects, such as ConnectionFactory instances, too (I am always looking for better ways to clean up factory-global state).

@mp911de
Copy link
Member Author

mp911de commented Jul 2, 2021

For ConnectionFactory we have Closeable that can be implemented to dispose any lingering resources. That seems the better fit for a connection factory than the Lifecycle interface.

@Michael-A-McMahon
Copy link
Contributor

Thanks for adding this. Would it make sense to declare Connection as extending Lifecycle? The specification text suggests that this should be the case.

@mp911de
Copy link
Member Author

mp911de commented Jul 2, 2021

I'm reluctant to add that to the Connection hierarchy as lifecycle methods are concerning an extremely small audience. The single Pool implementation can perform an additional instanceof check and so far only a single driver would make use of this extension.

I understood that part of the issue of the JDBC variant of these methods is that application users of the JDBC Connection are not sure what to do with these methods. Keeping these methods in a less prominent place should not lead to issues seen on the JDBC side.

@Michael-A-McMahon
Copy link
Contributor

Right, this makes sense. Because these methods are only used by connection pools, it doesn't benefit the application programmer to see them on Connection objects. In fact, we probably want the application programmers to ignore these methods. I think a pool implementation might want to assume that it has control over the lifecycle, and that application code is not going to be calling these methods as well.
Thanks for explaining.

@mp911de mp911de added this to the 0.9.0.M2 milestone Jul 9, 2021
@mp911de mp911de merged commit 05e16e6 into main Jul 9, 2021
@mp911de mp911de deleted the resource-lifecycle branch July 9, 2021 08:26
@mp911de mp911de changed the title Add draft for Lifecycle extension Add Lifecycle extension Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Demarcating checkin and checkout of a physical connection from a pool
3 participants