optimized for DruidPooledStatement #6539
Open
+64
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
在原来的实现中,如果复用了同一个
statement并且没有显示关闭结果集的话或者延迟关闭了会导致resultSetTrace保存大量没有必要的resultSet。大部分的数据库的jdbc实现都是一个statement只能持有一个打开的
resultSet,在打开新resultSet的时候会隐式关闭旧的连接,但是DruidPooledResultSet的实现又包裹了一层closed,就会出现实际上rawResultSet已经关闭了但是外层DruidPooledResultSet的closed还是false的状态出现。虽然这个pr不能完全解决因为各种奇奇怪怪的问题导致的
DruidPooledResultSet的关闭状态内外不一致的情况,但是可以在一定程度上减轻resultSetTrace的泄露问题。并且这样可以保持和底层数据库使用同一个
statement的行为是一致的。(包括非标准情况,如果底层的rawResultSet没有被关闭我们还是可以继续跟踪他们,如果被关闭了,也没有必要跟踪了)