From 72a6a670ace9061e45136b19ce34b83c4dbca11f Mon Sep 17 00:00:00 2001 From: tedyu Date: Tue, 13 Jan 2015 10:51:56 -0800 Subject: [PATCH] HBASE-12849 LoadIncrementalHFiles should use unmanaged connection in branch-1 --- .../hadoop/hbase/mapreduce/LoadIncrementalHFiles.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; }