From 28d20d03b60f1f2b58433b51e69b1f08fb89af75 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Fri, 7 Nov 2014 11:14:33 +0000 Subject: [PATCH] HCOLL-192 I've reviewed the code around this, it looks like this size constraint was a hang up from when we only allowed replicated entries to be no larger than max unsigned short, the underlying code was changed recently when we introduced the stateless client to allow much larger payloads. As such I've have increased this constrain to Integer.MAX_VALUE --- .../net/openhft/chronicle/map/ReplicatedChronicleMap.java | 6 +++--- src/main/java/net/openhft/chronicle/map/TcpReplicator.java | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java index 6ca4a1bcc..9348e0c09 100644 --- a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java @@ -87,7 +87,6 @@ final class ReplicatedChronicleMap, // for file, jdbc and UDP replication public static final int RESERVED_MOD_ITER = 8; public static final int ADDITIONAL_ENTRY_BYTES = 10; - static final int MAX_UNSIGNED_SHORT = Character.MAX_VALUE; private static final long serialVersionUID = 0L; private static final Logger LOG = LoggerFactory.getLogger(ReplicatedChronicleMap.class); private static final long LAST_UPDATED_HEADER_SIZE = 128L * 8L; @@ -632,12 +631,13 @@ final class ReplicatedChronicleMap, keySizeMarshaller.sizeEncodingSize(keySize) + keySize + ADDITIONAL_ENTRY_BYTES + valueSizeMarshaller.sizeEncodingSize(valueSize)) + valueSize; // replication enforces that the entry size will never be larger than an unsigned short - if (result > MAX_UNSIGNED_SHORT) + if (result > Integer.MAX_VALUE) throw new IllegalStateException("ENTRY WRITE_BUFFER_SIZE TOO LARGE : Replicated " + "ChronicleMap's" + " are restricted to an " + - "entry size of " + MAX_UNSIGNED_SHORT + ", " + + "entry size of " + Integer.MAX_VALUE + ", " + "your entry size=" + result); + return result; } diff --git a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java index bab8a8b8d..ab4d0ed7f 100644 --- a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java +++ b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java @@ -1052,7 +1052,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable final int inPosition = in.position(); - long outPosition = out.position(); long outLimit = out.limit(); @@ -1792,7 +1791,6 @@ class StatelessServerConnector { /** * write the keysize and the key to the the {@code target} buffer * - * @param local * @param key the key of the map */ @@ -1855,7 +1853,7 @@ class StatelessServerConnector { private long header(Bytes writer, final long transactionId) { final long sizeLocation = writer.position(); - writer.skip(TRANSACTION_ID_OFFSET); // SIZE_OF_SIZE + is + writer.skip(TRANSACTION_ID_OFFSET); // exception writer.writeLong(transactionId);