[
https://issues.apache.org/jira/browse/GROOVY-12371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112077#comment-18112077
]
ASF GitHub Bot commented on GROOVY-12371:
-----------------------------------------
daniellansun commented on code in PR #2895:
URL: https://github.com/apache/groovy/pull/2895#discussion_r3944295194
##########
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java:
##########
@@ -5057,8 +5111,18 @@ private Statement
getAbstractStatement(AbstractStatementCommand cmd, Connection
if (cacheStatements) {
stmt = statementCache.get(sql);
if (stmt == null) {
- stmt = cmd.execute(connection, sql);
- statementCache.put(sql, stmt);
+ Statement created = cmd.execute(connection, sql);
+ synchronized (statementCache) {
+ Statement raced = statementCache.get(sql);
Review Comment:
Understood
> SQL: bound the statement cache and make it thread-safe
> ------------------------------------------------------
>
> Key: GROOVY-12371
> URL: https://issues.apache.org/jira/browse/GROOVY-12371
> Project: Groovy
> Issue Type: Task
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)