mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-197 - added better support for buffer resize to prevent issues around Integer.MAX_SIZE
This commit is contained in:
@@ -477,6 +477,10 @@ abstract class AbstractChannelReplicator implements Closeable {
|
||||
|
||||
}
|
||||
|
||||
public boolean shouldBeIgnored(final Bytes entry, final int chronicleId) {
|
||||
return !externalizable.identifierCheck(entry, chronicleId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onEntry(final Bytes entry, final int chronicleId) {
|
||||
@@ -494,8 +498,14 @@ abstract class AbstractChannelReplicator implements Closeable {
|
||||
int entrySize = externalizable.sizeOfEntry(entry, chronicleId);
|
||||
|
||||
if (entrySize > in.remaining()) {
|
||||
|
||||
long newSize = in.position() + entrySize;
|
||||
assert newSize < Integer.MAX_VALUE;
|
||||
|
||||
// This can occur when we pack a number of entries into the buffer and the
|
||||
// last entry is very large.
|
||||
if (newSize > Integer.MAX_VALUE)
|
||||
return false;
|
||||
|
||||
resizeBuffer((int) newSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user