asdf2014 commented on a change in pull request #6868: Fix deadlock in 
DruidStatement & DruidConnection
URL: https://github.com/apache/incubator-druid/pull/6868#discussion_r248909642
 
 

 ##########
 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:
   Hmmm... Please help me figure out that our initial goal should be to hope 
that `statements` can be accessed synchronously. Why not add the 
`@GuardedBy("connectionLock")` annotation to the `statements` property, but add 
the `connectionLock` object itself. So I don't understand what this annotation 
means here.

----------------------------------------------------------------
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]

Reply via email to