HBASE-10036 Fix Potential Resource Leak in MetaReader
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1545871 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cc0d80fada
commit
fc67c8a8b8
|
@ -533,8 +533,9 @@ public class MetaReader {
|
||||||
}
|
}
|
||||||
scan.addFamily(HConstants.CATALOG_FAMILY);
|
scan.addFamily(HConstants.CATALOG_FAMILY);
|
||||||
HTable metaTable = getMetaHTable(catalogTracker);
|
HTable metaTable = getMetaHTable(catalogTracker);
|
||||||
ResultScanner scanner = metaTable.getScanner(scan);
|
ResultScanner scanner = null;
|
||||||
try {
|
try {
|
||||||
|
scanner = metaTable.getScanner(scan);
|
||||||
Result data;
|
Result data;
|
||||||
while((data = scanner.next()) != null) {
|
while((data = scanner.next()) != null) {
|
||||||
if (data.isEmpty()) continue;
|
if (data.isEmpty()) continue;
|
||||||
|
@ -542,7 +543,7 @@ public class MetaReader {
|
||||||
if (!visitor.visit(data)) break;
|
if (!visitor.visit(data)) break;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
scanner.close();
|
if (scanner != null) scanner.close();
|
||||||
metaTable.close();
|
metaTable.close();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue