diff --git a/core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/ApiDocsInterceptor.java b/core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/ApiDocsInterceptor.java index 1d56b3a9b..90c4ad691 100644 --- a/core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/ApiDocsInterceptor.java +++ b/core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/ApiDocsInterceptor.java @@ -40,9 +40,11 @@ public class ApiDocsInterceptor extends AbstractInterceptor { @Override public Outcome handleRequest(Exchange exc) throws Exception { - if(!initialized) { - ruleApiSpecs = initializeRuleApiSpecs(); - initialized = true; + synchronized(this) { + if (!initialized) { + ruleApiSpecs = initializeRuleApiSpecs(); + initialized = true; + } } var publisher = new OpenAPIPublisher(ruleApiSpecs);