r2dbc-mysql icon indicating copy to clipboard operation
r2dbc-mysql copied to clipboard

Support opitonal Closeable interface for other stateful objects

Open jchrys opened this issue 2 years ago • 2 comments
trafficstars

While Connection already implements Closeable as a mandatory part of R2DBC, other stateful objects such as ConnectionFactory could benefit from providing a way to release their resources through implementing the Closeable interface.

This is an optional feature, so it is not mandatory to implement it according to the R2DBC specification.

However, it would be useful for those who need to manually close their resources without blocking the caller.

refer: https://r2dbc.io/spec/1.0.0.RELEASE/spec/html/#closeable

jchrys avatar Apr 01 '23 16:04 jchrys

IMO, the MySQLConnectionFactory isn't a stateful object event if it contains a client (Mono type).

But I'm willing to refactor it to make the method MySqlConnectionFactory#create clearer.

JohnNiang avatar Feb 10 '25 03:02 JohnNiang

@JohnNiang Thanks for your thoughts, that make sense. If you have a refactoring approach in mind to make MySqlConnectionFactory#create clearer, I’d love to see it!

jchrys avatar Feb 10 '25 03:02 jchrys