git commit: PHOENIX-1141 Fix HTable resource leak in ConnectionQueryServicesImpl.metaDataCoprocessorExec (SamarthJain)

2014-08-01 Thread mujtaba
Repository: phoenix
Updated Branches:
  refs/heads/master e463a22cb -> 90b9ec8ec


PHOENIX-1141 Fix HTable resource leak in 
ConnectionQueryServicesImpl.metaDataCoprocessorExec (SamarthJain)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/90b9ec8e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/90b9ec8e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/90b9ec8e

Branch: refs/heads/master
Commit: 90b9ec8ec914e3d1ee04f4154d57cd3fe80856b7
Parents: e463a22
Author: Mujtaba 
Authored: Fri Aug 1 11:19:25 2014 -0700
Committer: Mujtaba 
Committed: Fri Aug 1 11:19:25 2014 -0700

--
 .../query/ConnectionQueryServicesImpl.java  | 25 +++-
 1 file changed, 14 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/90b9ec8e/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 93cb241..066e753 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -26,7 +26,6 @@ import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAM
 import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_DROP_METADATA;
 
 import java.io.IOException;
-import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.Collections;
 import java.util.List;
@@ -885,17 +884,21 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 HTableInterface ht = 
this.getTable(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES);
-final Map results =
-ht.coprocessorService(MetaDataService.class, tableKey, 
tableKey, callable);
-
-assert(results.size() == 1);
-MetaDataResponse result = results.values().iterator().next();
-if (result.getReturnCode() == 
MetaDataProtos.MutationCode.TABLE_NOT_IN_REGION) {
-if (retried) return 
MetaDataMutationResult.constructFromProto(result);
-retried = true;
-continue;
+try {
+final Map results =
+ht.coprocessorService(MetaDataService.class, 
tableKey, tableKey, callable);
+
+assert(results.size() == 1);
+MetaDataResponse result = 
results.values().iterator().next();
+if (result.getReturnCode() == 
MetaDataProtos.MutationCode.TABLE_NOT_IN_REGION) {
+if (retried) return 
MetaDataMutationResult.constructFromProto(result);
+retried = true;
+continue;
+}
+return MetaDataMutationResult.constructFromProto(result);
+} finally {
+Closeables.closeQuietly(ht);
 }
-return MetaDataMutationResult.constructFromProto(result);
 }
 } catch (IOException e) {
 throw ServerUtil.parseServerException(e);



git commit: PHOENIX-1141 Fix HTable resource leak in ConnectionQueryServicesImpl.metaDataCoprocessorExec (SamarthJain)

2014-08-01 Thread mujtaba
Repository: phoenix
Updated Branches:
  refs/heads/4.0 55c2ea21e -> 0c9863ed9


PHOENIX-1141 Fix HTable resource leak in 
ConnectionQueryServicesImpl.metaDataCoprocessorExec (SamarthJain)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0c9863ed
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0c9863ed
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0c9863ed

Branch: refs/heads/4.0
Commit: 0c9863ed9711faa46bc66740d0ba2a9bfd4263b3
Parents: 55c2ea2
Author: Mujtaba 
Authored: Fri Aug 1 11:18:35 2014 -0700
Committer: Mujtaba 
Committed: Fri Aug 1 11:18:35 2014 -0700

--
 .../query/ConnectionQueryServicesImpl.java  | 25 +++-
 1 file changed, 14 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c9863ed/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 4ac64d4..ff70adb 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -26,7 +26,6 @@ import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAM
 import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_DROP_METADATA;
 
 import java.io.IOException;
-import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.Collections;
 import java.util.List;
@@ -885,17 +884,21 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 HTableInterface ht = 
this.getTable(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES);
-final Map results =
-ht.coprocessorService(MetaDataService.class, tableKey, 
tableKey, callable);
-
-assert(results.size() == 1);
-MetaDataResponse result = results.values().iterator().next();
-if (result.getReturnCode() == 
MetaDataProtos.MutationCode.TABLE_NOT_IN_REGION) {
-if (retried) return 
MetaDataMutationResult.constructFromProto(result);
-retried = true;
-continue;
+try {
+final Map results =
+ht.coprocessorService(MetaDataService.class, 
tableKey, tableKey, callable);
+
+assert(results.size() == 1);
+MetaDataResponse result = 
results.values().iterator().next();
+if (result.getReturnCode() == 
MetaDataProtos.MutationCode.TABLE_NOT_IN_REGION) {
+if (retried) return 
MetaDataMutationResult.constructFromProto(result);
+retried = true;
+continue;
+}
+return MetaDataMutationResult.constructFromProto(result);
+} finally {
+Closeables.closeQuietly(ht);
 }
-return MetaDataMutationResult.constructFromProto(result);
 }
 } catch (IOException e) {
 throw ServerUtil.parseServerException(e);