HCOLL-167 added support to auto resize the buffers.

This commit is contained in:
Rob Austin
2014-10-29 11:01:03 +00:00
parent cafc507782
commit ebecafe54a
@@ -914,7 +914,11 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable {
}
private void writeKey(K key) {
keyValueSerializer.writeKey(key, bytes);
try {
keyValueSerializer.writeKey(key, bytes);
} catch (IllegalArgumentException e) {
resizeBuffer(bytes.capacity() + maxEntrySize);
}
}
private V readKey(final long sizeLocation) {
@@ -922,9 +926,11 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable {
}
private void writeValue(V value) {
// LOG.info("bytes position=" + bytes.position() + ",capacity=" + bytes.capacity() + ", " +
// "limit=" + bytes.limit());
keyValueSerializer.writeValue(value, bytes);
try {
keyValueSerializer.writeValue(value, bytes);
} catch (IllegalArgumentException e) {
resizeBuffer(bytes.capacity() + maxEntrySize);
}
}
private Set<K> readKeySet(Bytes in) {