提交 b22ed608 authored 作者: Thomas Mueller's avatar Thomas Mueller

Off-heap storage

上级 76f8ac82
...@@ -38,14 +38,11 @@ public class OffHeapStore extends FileStore { ...@@ -38,14 +38,11 @@ public class OffHeapStore extends FileStore {
} }
readCount++; readCount++;
ByteBuffer buff = memEntry.getValue(); ByteBuffer buff = memEntry.getValue();
int oldLimit = buff.limit(); ByteBuffer read = buff.duplicate();
int offset = (int) (pos - memEntry.getKey()); int offset = (int) (pos - memEntry.getKey());
buff.position(offset); read.position(offset);
buff.limit(len + offset); read.limit(len + offset);
ByteBuffer read = buff.slice(); return read.slice();
buff.position(0);
buff.limit(oldLimit);
return read;
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论