diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar-reactive/src/main/java/smoketest/pulsar/reactive/SampleMessageConsumer.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar-reactive/src/main/java/smoketest/pulsar/reactive/SampleMessageConsumer.java index 02cbe74469..92ed71072e 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar-reactive/src/main/java/smoketest/pulsar/reactive/SampleMessageConsumer.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar-reactive/src/main/java/smoketest/pulsar/reactive/SampleMessageConsumer.java @@ -16,8 +16,8 @@ package smoketest.pulsar.reactive; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import reactor.core.publisher.Mono; @@ -27,7 +27,7 @@ import org.springframework.stereotype.Component; @Component class SampleMessageConsumer { - private List consumed = new ArrayList<>(); + private List consumed = new CopyOnWriteArrayList<>(); List getConsumed() { return this.consumed; diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar/src/main/java/smoketest/pulsar/SampleMessageConsumer.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar/src/main/java/smoketest/pulsar/SampleMessageConsumer.java index e3c80cf223..196dcbb5b4 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar/src/main/java/smoketest/pulsar/SampleMessageConsumer.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar/src/main/java/smoketest/pulsar/SampleMessageConsumer.java @@ -16,8 +16,8 @@ package smoketest.pulsar; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import org.springframework.pulsar.annotation.PulsarListener; import org.springframework.stereotype.Component; @@ -25,7 +25,7 @@ import org.springframework.stereotype.Component; @Component class SampleMessageConsumer { - private List consumed = new ArrayList<>(); + private List consumed = new CopyOnWriteArrayList<>(); List getConsumed() { return this.consumed;