HBASE-6247. [REST] HTablePool.putTable is deprecated

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1352348 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2012-06-20 21:45:08 +00:00
parent 3ec92cc8b1
commit 9aca0a9450
5 changed files with 19 additions and 42 deletions

View File

@ -76,7 +76,7 @@ public class RegionsResource extends ResourceBase {
try { try {
return ((HTable)table).getRegionsInfo(); return ((HTable)table).getRegionsInfo();
} finally { } finally {
pool.putTable(table); table.close();
} }
} }

View File

@ -213,14 +213,9 @@ public class RowResource extends ResourceBase {
throw new WebApplicationException(e, throw new WebApplicationException(e,
Response.Status.SERVICE_UNAVAILABLE); Response.Status.SERVICE_UNAVAILABLE);
} finally { } finally {
if (table != null) { if (table != null) try {
try { table.close();
pool.putTable(table); } catch (IOException ioe) { }
} catch (IOException ioe) {
throw new WebApplicationException(ioe,
Response.Status.SERVICE_UNAVAILABLE);
}
}
} }
} }
@ -275,14 +270,9 @@ public class RowResource extends ResourceBase {
throw new WebApplicationException(e, throw new WebApplicationException(e,
Response.Status.SERVICE_UNAVAILABLE); Response.Status.SERVICE_UNAVAILABLE);
} finally { } finally {
if (table != null) { if (table != null) try {
try { table.close();
pool.putTable(table); } catch (IOException ioe) { }
} catch (IOException ioe) {
throw new WebApplicationException(ioe,
Response.Status.SERVICE_UNAVAILABLE);
}
}
} }
} }
@ -373,14 +363,9 @@ public class RowResource extends ResourceBase {
throw new WebApplicationException(e, throw new WebApplicationException(e,
Response.Status.SERVICE_UNAVAILABLE); Response.Status.SERVICE_UNAVAILABLE);
} finally { } finally {
if (table != null) { if (table != null) try {
try { table.close();
pool.putTable(table); } catch (IOException ioe) { }
} catch (IOException ioe) {
throw new WebApplicationException(ioe,
Response.Status.SERVICE_UNAVAILABLE);
}
}
} }
return Response.ok().build(); return Response.ok().build();
} }
@ -450,14 +435,9 @@ public class RowResource extends ResourceBase {
} catch (IOException e) { } catch (IOException e) {
throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE); throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE);
} finally { } finally {
try { if (table != null) try {
if(table != null){ table.close();
pool.putTable(table); } catch (IOException ioe) { }
}
} catch (Exception ioe) {
throw new WebApplicationException(ioe,
Response.Status.SERVICE_UNAVAILABLE);
}
} }
} }
@ -518,12 +498,9 @@ public class RowResource extends ResourceBase {
} catch (IOException e) { } catch (IOException e) {
throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE); throw new WebApplicationException(e, Response.Status.SERVICE_UNAVAILABLE);
} finally { } finally {
try { if (table != null) try {
pool.putTable(table); table.close();
} catch (Exception ioe) { } catch (IOException ioe) { }
throw new WebApplicationException(ioe,
Response.Status.SERVICE_UNAVAILABLE);
}
} }
} }
} }

View File

@ -78,7 +78,7 @@ public class RowResultGenerator extends ResultGenerator {
// the log. // the log.
LOG.warn(StringUtils.stringifyException(e)); LOG.warn(StringUtils.stringifyException(e));
} finally { } finally {
pool.putTable(table); table.close();
} }
} }

View File

@ -92,7 +92,7 @@ public class ScannerResultGenerator extends ResultGenerator {
id = Long.toString(System.currentTimeMillis()) + id = Long.toString(System.currentTimeMillis()) +
Integer.toHexString(scanner.hashCode()); Integer.toHexString(scanner.hashCode());
} finally { } finally {
pool.putTable(table); table.close();
} }
} }

View File

@ -83,7 +83,7 @@ public class SchemaResource extends ResourceBase {
try { try {
return table.getTableDescriptor(); return table.getTableDescriptor();
} finally { } finally {
pool.putTable(table); table.close();
} }
} }