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

 ##########
 File path: sql/src/main/java/org/apache/druid/sql/avatica/DruidConnection.java
 ##########
 @@ -52,26 +52,30 @@
   private final ImmutableMap<String, Object> context;
   private final AtomicInteger statementCounter = new AtomicInteger();
   private final AtomicReference<Future<?>> timeoutFuture = new 
AtomicReference<>();
-
-  @GuardedBy("statements")
   private final Map<Integer, DruidStatement> statements;
 
 Review comment:
   IMO, things would be more clear if you changed the type of `statements` to a 
ConcurrentMap and added one more comment here about how it should be accessed. 
The variable is sometimes accessed under lock and sometimes not, and that can 
be tough for readers to figure out.
   
   ```java
   // Typically synchronized by connectionLock, except in one case: the onClose 
function passed
   // into DruidStatements contained by the map.
   private final ConcurrentMap<Integer, DruidStatement> statements;
   ```

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