HBASE-4956 Control direct memory buffer consumption by HBaseClient (Bob Copeland)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1363526 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1a6834c8c9
commit
309f846827
|
@ -720,10 +720,18 @@ public class Result implements Writable, WritableWithSize {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
byte [] raw = new byte[totalBuffer];
|
byte [] raw = new byte[totalBuffer];
|
||||||
in.readFully(raw, 0, totalBuffer);
|
readChunked(in, raw, 0, totalBuffer);
|
||||||
bytes = new ImmutableBytesWritable(raw, 0, totalBuffer);
|
bytes = new ImmutableBytesWritable(raw, 0, totalBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void readChunked(final DataInput in, byte[] dest, int ofs, int len)
|
||||||
|
throws IOException {
|
||||||
|
int maxRead = 8192;
|
||||||
|
|
||||||
|
for (; ofs < len; ofs += maxRead)
|
||||||
|
in.readFully(dest, ofs, Math.min(len - ofs, maxRead));
|
||||||
|
}
|
||||||
|
|
||||||
//Create KeyValue[] when needed
|
//Create KeyValue[] when needed
|
||||||
private void readFields() {
|
private void readFields() {
|
||||||
if (bytes == null) {
|
if (bytes == null) {
|
||||||
|
|
Loading…
Reference in New Issue