diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java index 7866c100558..21159788ddd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java @@ -933,10 +933,12 @@ public class LoadIncrementalHFiles extends Configured implements Tool { } Path hfofDir = new Path(dirPath); - Connection connection = ConnectionFactory.createConnection(getConf()); - HTable table = (HTable) connection.getTable(tableName); - doBulkLoad(hfofDir, table); + try (Connection connection = ConnectionFactory.createConnection(getConf()); + HTable table = (HTable) connection.getTable(tableName);) { + doBulkLoad(hfofDir, table); + } + return 0; }