You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by th...@apache.org on 2014/04/01 23:21:18 UTC
svn commit: r1583792 -
/hive/branches/branch-0.13/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
Author: thejas
Date: Tue Apr 1 21:21:17 2014
New Revision: 1583792
URL: http://svn.apache.org/r1583792
Log:
HIVE-6789 : HiveStatement client transport lock should unlock in finally block. (Vaibhav Gumashta via Thejas Nair)
Modified:
hive/branches/branch-0.13/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
Modified: hive/branches/branch-0.13/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java?rev=1583792&r1=1583791&r2=1583792&view=diff
==============================================================================
--- hive/branches/branch-0.13/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java (original)
+++ hive/branches/branch-0.13/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java Tue Apr 1 21:21:17 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()) {