HBASE-18180 Possible connection leak while closing BufferedMutator in TableOutputFormat
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
c6e71f159c
commit
ce1ce728c6
|
@ -84,11 +84,14 @@ public class TableOutputFormat extends FileOutputFormat<ImmutableBytesWritable,
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(Reporter reporter) throws IOException {
|
public void close(Reporter reporter) throws IOException {
|
||||||
if (this.m_mutator != null) {
|
try {
|
||||||
this.m_mutator.close();
|
if (this.m_mutator != null) {
|
||||||
}
|
this.m_mutator.close();
|
||||||
if (conn != null) {
|
}
|
||||||
this.conn.close();
|
} finally {
|
||||||
|
if (conn != null) {
|
||||||
|
this.conn.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,16 @@ implements Configurable {
|
||||||
* @see RecordWriter#close(TaskAttemptContext)
|
* @see RecordWriter#close(TaskAttemptContext)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close(TaskAttemptContext context)
|
public void close(TaskAttemptContext context) throws IOException {
|
||||||
throws IOException {
|
try {
|
||||||
mutator.close();
|
if (mutator != null) {
|
||||||
connection.close();
|
mutator.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (connection != null) {
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue