From 9aca0a945080f93375b8b3f5ff0b4513b1b1d564 Mon Sep 17 00:00:00 2001 From: Andrew Kyle Purtell Date: Wed, 20 Jun 2012 21:45:08 +0000 Subject: [PATCH] HBASE-6247. [REST] HTablePool.putTable is deprecated git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1352348 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/rest/RegionsResource.java | 2 +- .../apache/hadoop/hbase/rest/RowResource.java | 53 ++++++------------- .../hadoop/hbase/rest/RowResultGenerator.java | 2 +- .../hbase/rest/ScannerResultGenerator.java | 2 +- .../hadoop/hbase/rest/SchemaResource.java | 2 +- 5 files changed, 19 insertions(+), 42 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java index b19a1d3c548..c5667a131a6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java @@ -76,7 +76,7 @@ public class RegionsResource extends ResourceBase { try { return ((HTable)table).getRegionsInfo(); } finally { - pool.putTable(table); + table.close(); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java index e32e2be6105..db4fa60a14e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java @@ -213,14 +213,9 @@ public class RowResource extends ResourceBase { throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE); } finally { - if (table != null) { - try { - pool.putTable(table); - } catch (IOException ioe) { - throw new WebApplicationException(ioe, - Response.Status.SERVICE_UNAVAILABLE); - } - } + if (table != null) try { + table.close(); + } catch (IOException ioe) { } } } @@ -275,14 +270,9 @@ public class RowResource extends ResourceBase { throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE); } finally { - if (table != null) { - try { - pool.putTable(table); - } catch (IOException ioe) { - throw new WebApplicationException(ioe, - Response.Status.SERVICE_UNAVAILABLE); - } - } + if (table != null) try { + table.close(); + } catch (IOException ioe) { } } } @@ -373,14 +363,9 @@ public class RowResource extends ResourceBase { throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE); } finally { - if (table != null) { - try { - pool.putTable(table); - } catch (IOException ioe) { - throw new WebApplicationException(ioe, - Response.Status.SERVICE_UNAVAILABLE); - } - } + if (table != null) try { + table.close(); + } catch (IOException ioe) { } } return Response.ok().build(); } @@ -450,14 +435,9 @@ public class RowResource extends ResourceBase { } catch (IOException e) { throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE); } finally { - try { - if(table != null){ - pool.putTable(table); - } - } catch (Exception ioe) { - throw new WebApplicationException(ioe, - Response.Status.SERVICE_UNAVAILABLE); - } + if (table != null) try { + table.close(); + } catch (IOException ioe) { } } } @@ -518,12 +498,9 @@ public class RowResource extends ResourceBase { } catch (IOException e) { throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE); } finally { - try { - pool.putTable(table); - } catch (Exception ioe) { - throw new WebApplicationException(ioe, - Response.Status.SERVICE_UNAVAILABLE); - } + if (table != null) try { + table.close(); + } catch (IOException ioe) { } } } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java index 84891cf0508..3bed1b5b763 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java @@ -78,7 +78,7 @@ public class RowResultGenerator extends ResultGenerator { // the log. LOG.warn(StringUtils.stringifyException(e)); } finally { - pool.putTable(table); + table.close(); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResultGenerator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResultGenerator.java index 69ff1f6982d..24330c80ab4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResultGenerator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResultGenerator.java @@ -92,7 +92,7 @@ public class ScannerResultGenerator extends ResultGenerator { id = Long.toString(System.currentTimeMillis()) + Integer.toHexString(scanner.hashCode()); } finally { - pool.putTable(table); + table.close(); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java index cff967aac9d..49fbf389988 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java @@ -83,7 +83,7 @@ public class SchemaResource extends ResourceBase { try { return table.getTableDescriptor(); } finally { - pool.putTable(table); + table.close(); } }