From f70d8b262a78fd61244f67aa9bcb3afd045e7427 Mon Sep 17 00:00:00 2001 From: leventov Date: Fri, 2 Oct 2015 11:37:18 +0300 Subject: [PATCH] Add a comment on ChronicleMapBuilder.MAX_SEGMENTS choice --- .../net/openhft/chronicle/map/ChronicleMapBuilder.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java index 4d6038119..4152cca5c 100755 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java @@ -112,6 +112,14 @@ public final class ChronicleMapBuilder implements static final byte UDP_REPLICATION_MODIFICATION_ITERATOR_ID = (byte) 127; private static final int DEFAULT_KEY_OR_VALUE_SIZE = 120; private static final long DEFAULT_ENTRIES = 1 << 20; + /** + * If want to increase this number, note {@link OldDeletedEntriesCleanup} uses array to store + * all segment indexes -- so it could be current JVM max array size, not Integer.MAX_VALUE + * (which is an obvious limitation, as many APIs and internals use int type for representing + * segment index). + * + * Anyway, unlikely anyone ever need more than 1 billion segments. + */ private static final int MAX_SEGMENTS = (1 << 30); private static final Logger LOG = LoggerFactory.getLogger(ChronicleMapBuilder.class.getName());