ChinmaySKulkarni commented on a change in pull request #771:
URL: https://github.com/apache/phoenix/pull/771#discussion_r417610723



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
##########
@@ -655,13 +678,20 @@ public void close() throws SQLException {
                     traceScope.close();
                 }
                 closeStatements();
+                if(childConnections != null) {
+                    SQLCloseables.closeAllQuietly(childConnections);

Review comment:
       This is guaranteed to only ever happen from 1 thread at a time I 
suppose? Which is why we wouldn't care about thread-safety of `closeAllQuietly`?

##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
##########
@@ -441,6 +453,17 @@ private static Properties 
filterKnownNonProperties(Properties info) {
         return result.build();
     }
 
+    public boolean isInternalConnection() {
+        return isInternalConnection;
+    }
+
+    public void addChildConnection(PhoenixConnection connection) {

Review comment:
       If you're worried about multiple threads calling `addChildConnection` on 
the same connection object, then this method is still not thread safe. You need 
to synchronize the null check and element addition as an entire atomic 
operation.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to