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



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -484,6 +484,16 @@ private void openConnection() throws SQLException {
         }
     }
 
+    // Close the HBase Connection
+    private void closeConnection() throws IOException {
+        if (connection != null) {
+            LOGGER.info("HConnection closed. Stacktrace for informational 
purposes: "
+                + connection + " " + LogUtil.getCallerStackTrace());
+            connection.close();

Review comment:
       Put the log line after the call. If `connection.close()` throws then the 
log line will be misleading.

##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -3322,7 +3331,7 @@ public Void call() throws Exception {
                         } finally {
                             try {
                                 if (!success && hConnectionEstablished) {
-                                    connection.close();
+                                    closeConnection();

Review comment:
       One nice side-effect of your change is that we will be decrementing 
`GLOBAL_HCONNECTIONS_COUNTER` at this point now, which looks like we were 
missing before.




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