From 90f74530f5127b94026c635de96b67c9bfd8e9f7 Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Wed, 13 Sep 2023 13:09:25 -0400 Subject: [PATCH] Marks DCF as initialized in the constructor Signed-off-by: Darshit Chanpura --- .../security/securityconf/DynamicConfigFactory.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/org/opensearch/security/securityconf/DynamicConfigFactory.java b/src/main/java/org/opensearch/security/securityconf/DynamicConfigFactory.java index 53c553451b..da3c8316f2 100644 --- a/src/main/java/org/opensearch/security/securityconf/DynamicConfigFactory.java +++ b/src/main/java/org/opensearch/security/securityconf/DynamicConfigFactory.java @@ -34,7 +34,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicBoolean; import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; @@ -125,7 +124,6 @@ public final static SecurityDynamicConfiguration addStatics(SecurityDynamicCo protected final Logger log = LogManager.getLogger(this.getClass()); private final ConfigurationRepository cr; - private final AtomicBoolean initialized = new AtomicBoolean(); private final EventBus eventBus = EVENT_BUS_BUILDER.logger(new JavaLogger(DynamicConfigFactory.class.getCanonicalName())).build(); private final Settings opensearchSettings; private final Path configPath; @@ -160,6 +158,7 @@ public DynamicConfigFactory( registerDCFListener(this.iab); this.cr.subscribeOnChange(this); + initializationLatch.countDown(); } @Override @@ -314,7 +313,6 @@ public void onChange(Map> typeToConfig) { eventBus.post(audit); } - initialized.set(true); initializationLatch.countDown(); } @@ -333,7 +331,6 @@ private static ConfigV7 getConfigV7(SecurityDynamicConfiguration sdc) { public void waitForInit() throws InterruptedException { // wait for DCF to completely initialized initializationLatch.await(); - } public void registerDCFListener(Object listener) {