HBASE-10043 Fix Potential Resouce Leak in MultiTableInputFormatBase
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1549726 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8ba036b72f
commit
0b737248c3
|
@ -83,15 +83,24 @@ public abstract class MultiTableInputFormatBase extends
|
||||||
new HTable(context.getConfiguration(), tSplit.getTableName());
|
new HTable(context.getConfiguration(), tSplit.getTableName());
|
||||||
|
|
||||||
TableRecordReader trr = this.tableRecordReader;
|
TableRecordReader trr = this.tableRecordReader;
|
||||||
// if no table record reader was provided use default
|
|
||||||
if (trr == null) {
|
try {
|
||||||
trr = new TableRecordReader();
|
// if no table record reader was provided use default
|
||||||
|
if (trr == null) {
|
||||||
|
trr = new TableRecordReader();
|
||||||
|
}
|
||||||
|
Scan sc = tSplit.getScan();
|
||||||
|
sc.setStartRow(tSplit.getStartRow());
|
||||||
|
sc.setStopRow(tSplit.getEndRow());
|
||||||
|
trr.setScan(sc);
|
||||||
|
trr.setHTable(table);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
// If there is an exception make sure that all
|
||||||
|
// resources are closed and released.
|
||||||
|
table.close();
|
||||||
|
trr.close();
|
||||||
|
throw ioe;
|
||||||
}
|
}
|
||||||
Scan sc = tSplit.getScan();
|
|
||||||
sc.setStartRow(tSplit.getStartRow());
|
|
||||||
sc.setStopRow(tSplit.getEndRow());
|
|
||||||
trr.setScan(sc);
|
|
||||||
trr.setHTable(table);
|
|
||||||
return trr;
|
return trr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue