diff --git a/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCacheSettings.java b/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCacheSettings.java index 3df6c4c6a0771..b89e8c517a351 100644 --- a/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCacheSettings.java +++ b/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCacheSettings.java @@ -60,12 +60,12 @@ public class TieredSpilloverCacheSettings { * Stores took time policy settings for various cache types as these are dynamic so that can be registered and * retrieved accordingly. */ - public static final Map> TOOK_TIME_POLICY_CONCRETE_SETTINGS_MAP = getConcreteTookTimePolicySettings(); + public static final Map> TOOK_TIME_POLICY_CONCRETE_SETTINGS_MAP; /** * Fetches concrete took time policy settings. */ - private static Map> getConcreteTookTimePolicySettings() { + static { Map> concreteTookTimePolicySettingMap = new HashMap<>(); for (CacheType cacheType : CacheType.values()) { concreteTookTimePolicySettingMap.put( @@ -73,7 +73,7 @@ private static Map> getConcreteTookTimePolicySetti TIERED_SPILLOVER_DISK_TOOK_TIME_THRESHOLD.getConcreteSettingForNamespace(cacheType.getSettingPrefix()) ); } - return concreteTookTimePolicySettingMap; + TOOK_TIME_POLICY_CONCRETE_SETTINGS_MAP = concreteTookTimePolicySettingMap; } /**