You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2025/06/11 01:29:12 UTC

Re: [PR] Resolve statement manager leaks when creating multiple statements. [shardingsphere]

Copilot commented on code in PR #35665:
URL: https://github.com/apache/shardingsphere/pull/35665#discussion_r2139003681


##########
jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java:
##########
@@ -66,7 +66,7 @@ public final class ShardingSphereConnection extends AbstractConnectionAdapter {
     private final DriverDatabaseConnectionManager databaseConnectionManager;
     
     @Getter
-    private final Collection<StatementManager> statementManagers = new CopyOnWriteArrayList<>();
+    private final Collection<StatementManager> statementManagers = new ConcurrentLinkedQueue<>();

Review Comment:
   [nitpick] Consider changing the field type to `Queue<StatementManager>` rather than `Collection`, which makes the intended FIFO/remove semantics more explicit.
   ```suggestion
       private final Queue<StatementManager> statementManagers = new ConcurrentLinkedQueue<>();
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org