gianm commented on a change in pull request #6868: Fix deadlock in
DruidStatement & DruidConnection
URL: https://github.com/apache/incubator-druid/pull/6868#discussion_r249599894
##########
File path: sql/src/main/java/org/apache/druid/sql/avatica/DruidConnection.java
##########
@@ -53,25 +54,29 @@
private final AtomicInteger statementCounter = new AtomicInteger();
private final AtomicReference<Future<?>> timeoutFuture = new
AtomicReference<>();
- @GuardedBy("statements")
- private final Map<Integer, DruidStatement> statements;
+ // Typically synchronized by connectionLock, except in one case: the onClose
function passed
+ // into DruidStatements contained by the map.
+ private final ConcurrentMap<Integer, DruidStatement> statements;
- @GuardedBy("statements")
+ @GuardedBy("connectionLock")
Review comment:
To me, it makes sense because `statements` is now _not_ always guarded by
`connectionLock`. But, it is in some (well, many) cases. The comment explains
it in a way that the annotation would struggle to.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]