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