From e96120e4b8340e0e77869874a39eb8cf1557a659 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Tue, 26 Jan 2021 16:13:41 +0000 Subject: [PATCH] https://github.com/OpenHFT/Chronicle-Map/issues/265 added max bloat factor --- .../openhft/chronicle/map/ChronicleMap.java | 18 ++++++++++++++++++ .../chronicle/map/VanillaChronicleMap.java | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ChronicleMap.java index 72297d694..b0fb3ec8a 100644 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMap.java @@ -237,5 +237,23 @@ public interface ChronicleMap extends ConcurrentMap, default int remainingAutoResizes() { throw new UnsupportedOperationException("todo"); } + + + /** + * The maximum number of times, the chronicle map is allowed to grow in size beyond + * the configured number of entries. + *

+ *

The default maximum bloat factor factor is {@code 1.0} - i. e. "no bloat is expected". + *

+ *

It is strongly advised not to configure {@code maxBloatFactor} to more than {@code 10.0}, + * almost certainly, you either should configure {@code ChronicleHash}es completely differently, + * or this data store doesn't fit to your case. + * + * @return maxBloatFactor the maximum number ot times, the chronicle map is alowed to be resized + */ + default double maxBloatFactor() { + throw new UnsupportedOperationException("todo"); + } + } diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index bcffece96..334a6dc4a 100644 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -280,6 +280,11 @@ public class VanillaChronicleMap return (int) (maxTiers() - tiersUsed()); } + @Override + public double maxBloatFactor() { + return maxBloatFactor; + } + @Override public short percentageFreeSpace() { throwExceptionIfClosed();