kgyrtkirk commented on a change in pull request #1920:
URL: https://github.com/apache/hive/pull/1920#discussion_r566793055



##########
File path: jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
##########
@@ -1104,18 +1102,18 @@ public void clearWarnings() throws SQLException {
 
   @Override
   public void close() throws SQLException {
-    if (!isClosed) {
-      TCloseSessionReq closeReq = new TCloseSessionReq(sessHandle);
       try {
-        client.CloseSession(closeReq);
+        if (!isClosed) {
+          TCloseSessionReq closeReq = new TCloseSessionReq(sessHandle);
+          client.CloseSession(closeReq);
+        }
       } catch (TException e) {
         throw new SQLException("Error while cleaning up the server resources", 
e);
       } finally {
         isClosed = true;
-        if (transport != null) {
+        if (transport != null && transport.isOpen()) {
           transport.close();
         }

Review comment:
       can we release the references as well?
   ```
   transport=null
   client=null
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to