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
ConnectionPool may have issues #51
Comments
@datatechnology I am not sure what you mean. Can you add an example? |
@oshai , I think @datatechnology means if I have the following code |
@oshai one suggestion, I know the wiki may help, however, it's always better to make illegal code cannot be compiled instead of having documents to avoid some bad patterned code. One possible fix in this case is to create a PooledConnection class, which inherits from Connection, and have two members, one is the pool and the other is the underlying connection, delegate all sendQuery requests to the underlying connection but connect and close methods, which just override to acquire underlying connection from pool and return the connection to the pool respectively |
@andy-yx-chen I think changing the way connection pool works in such a way will make it almost irrelevant to inherit Connection but more act like a connection provider. Also, it will break the simple usage of the pool when you don't need transactions. |
@datatechnology do you still have an issue or can I close it? |
I will help to create a PR to add a pooled connection that could have transactions cross multiple sendQuery calls |
@andy-yx-chen Thanks. So I am closing this issue and let's continue the discussion when you will have a PR. |
objectPool.use(executionContext) { it.sendPreparedStatement(query, values) }, this will mess up the executions when there is a transactions, as you may result in a transaction cross multiple connections but only commit in one
The text was updated successfully, but these errors were encountered: