From f882c45c8175808d044df834eb762ef79139041c Mon Sep 17 00:00:00 2001 From: Torben Burchgart Date: Fri, 12 Jul 2024 14:29:18 +0200 Subject: [PATCH] Made initialization of ruleApiSpecs thread-safe inside ApiDocsInterceptor --- .../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);