HBASE-15797 TestIPCUtil fails after HBASE-15795

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Jurriaan Mous 2016-05-08 08:43:28 +02:00 committed by stack
parent 11740570c1
commit 9d17e3d22a
1 changed files with 6 additions and 4 deletions

View File

@ -139,16 +139,16 @@ public class IPCUtil {
baos = new ByteBufferOutputStream(bufferSize);
}
Compressor poolCompressor = null;
try (OutputStream os = baos) {
OutputStream os2Compress = os;
OutputStream os = baos;
try {
if (compressor != null) {
if (compressor instanceof Configurable) {
((Configurable) compressor).setConf(this.conf);
}
poolCompressor = CodecPool.getCompressor(compressor);
os2Compress = compressor.createOutputStream(os, poolCompressor);
os = compressor.createOutputStream(os, poolCompressor);
}
Codec.Encoder encoder = codec.getEncoder(os2Compress);
Codec.Encoder encoder = codec.getEncoder(os);
int count = 0;
while (cellScanner.advance()) {
encoder.write(cellScanner.current());
@ -163,6 +163,8 @@ public class IPCUtil {
} catch (BufferOverflowException e) {
throw new DoNotRetryIOException(e);
} finally {
os.close();
if (poolCompressor != null) {
CodecPool.returnCompressor(poolCompressor);
}