From af117df42a76df18e308d4cc116d1adeeb9615c8 Mon Sep 17 00:00:00 2001 From: t-burch <119930761+t-burch@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:17:46 +0200 Subject: [PATCH] Made initialization of ruleApiSpecs thread-safe inside ApiDocsInterceptor (#1187) --- .../core/openapi/serviceproxy/ApiDocsInterceptor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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);