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) {