diff --git a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/testing.adoc b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/testing.adoc index 052e5efa..b19eef30 100644 --- a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/testing.adoc +++ b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/testing.adoc @@ -180,21 +180,20 @@ public final class EmbeddedKafkaHolder { public static EmbeddedKafkaBroker getEmbeddedKafka() { if (!started) { - try { - embeddedKafka.afterPropertiesSet(); - } - catch (Exception e) { - throw new KafkaException("Embedded broker failed to start", e); - } - started = true; + synchronized (this) { + if (!started) { + try { + embeddedKafka.afterPropertiesSet(); + } + catch (Exception e) { + throw new KafkaException("Embedded broker failed to start", e); + } + started = true; + } + } } return embeddedKafka; } - - private EmbeddedKafkaHolder() { - super(); - } - } ----