FAQ
Author: thejas
Date: Tue Apr 1 21:21:35 2014
New Revision: 1583794

URL: http://svn.apache.org/r1583794
Log:
HIVE-6789 : HiveStatement client transport lock should unlock in finally block. (Vaibhav Gumashta via Thejas Nair)

Modified:
     hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java

Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java?rev=1583794&r1=1583793&r2=1583794&view=diff
==============================================================================
--- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java (original)
+++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java Tue Apr 1 21:21:35 2014
@@ -124,13 +124,15 @@ public class HiveStatement implements ja
      try {
        transportLock.lock();
        TCancelOperationResp cancelResp = client.CancelOperation(cancelReq);
- transportLock.unlock();
        Utils.verifySuccessWithInfo(cancelResp.getStatus());
      } catch (SQLException e) {
        throw e;
      } catch (Exception e) {
        throw new SQLException(e.toString(), "08S01", e);
      }
+ finally {
+ transportLock.unlock();
+ }
    }

    /*
@@ -162,7 +164,6 @@ public class HiveStatement implements ja
          closeReq.setOperationHandle(stmtHandle);
          transportLock.lock();
          TCloseOperationResp closeResp = client.CloseOperation(closeReq);
- transportLock.unlock();
          Utils.verifySuccessWithInfo(closeResp.getStatus());
        }
      } catch (SQLException e) {
@@ -170,6 +171,9 @@ public class HiveStatement implements ja
      } catch (Exception e) {
        throw new SQLException(e.toString(), "08S01", e);
      }
+ finally {
+ transportLock.unlock();
+ }
      stmtHandle = null;
    }

@@ -226,12 +230,14 @@ public class HiveStatement implements ja
        TExecuteStatementResp execResp = client.ExecuteStatement(execReq);
        Utils.verifySuccessWithInfo(execResp.getStatus());
        stmtHandle = execResp.getOperationHandle();
- transportLock.unlock();
      } catch (SQLException eS) {
        throw eS;
      } catch (Exception ex) {
        throw new SQLException(ex.toString(), "08S01", ex);
      }
+ finally {
+ transportLock.unlock();
+ }

      TGetOperationStatusReq statusReq = new TGetOperationStatusReq(stmtHandle);
      boolean operationComplete = false;
@@ -245,8 +251,15 @@ public class HiveStatement implements ja
           * It will essentially return after the HIVE_SERVER2_LONG_POLLING_TIMEOUT (a server config) expires
           */
          transportLock.lock();
- statusResp = client.GetOperationStatus(statusReq);
- transportLock.unlock();
+ try {
+ statusResp = client.GetOperationStatus(statusReq);
+ }
+ catch (Exception e) {
+ throw e;
+ }
+ finally {
+ transportLock.unlock();
+ }
          Utils.verifySuccessWithInfo(statusResp.getStatus());
          if (statusResp.isSetOperationState()) {
            switch (statusResp.getOperationState()) {

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedApr 1, '14 at 9:21p
activeApr 1, '14 at 9:21p
posts1
users1
websitehive.apache.org

1 user in discussion

Thejas: 1 post

People

Translate

site design / logo © 2021 Grokbase