diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java index 22c5cc1..c238adb 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java @@ -122,8 +122,9 @@ public class IPCUtil { if (codec == null) throw new CellScannerButNoCodecException(); int bufferSize = this.cellBlockBuildingInitialBufferSize; ByteBufferOutputStream baos = null; + ByteBuffer bb = null; if (pool != null) { - ByteBuffer bb = pool.getBuffer(); + bb = pool.getBuffer(); bufferSize = bb.capacity(); baos = new ByteBufferOutputStream(bb); } else { @@ -155,7 +156,12 @@ public class IPCUtil { encoder.flush(); // If no cells, don't mess around. Just return null (could be a bunch of existence checking // gets or something -- stuff that does not return a cell). - if (count == 0) return null; + if (count == 0) { + if (pool != null && bb != null) { + pool.putBuffer(bb); + } + return null; + } } catch (BufferOverflowException e) { throw new DoNotRetryIOException(e); } finally { diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/CoordinatedStateManager.java hbase-server/src/main/java/org/apache/hadoop/hbase/CoordinatedStateManager.java index b7bfa75..bdb202d 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/CoordinatedStateManager.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/CoordinatedStateManager.java @@ -20,7 +20,7 @@ package org.apache.hadoop.hbase; import org.apache.hadoop.hbase.classification.InterfaceAudience; /** - * Implementations of this interface will keep and return to clients + * Implementations of this interface will keep and return to clients * implementations of classes providing API to execute * coordinated operations. This interface is client-side, so it does NOT * include methods to retrieve the particular interface implementations.