Protect against concurrent list updates in Pulsar samples

See gh-34763
pull/37196/head
Phillip Webb 1 year ago
parent 59e591c13c
commit 975cb27905

@ -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<SampleMessage> consumed = new ArrayList<>();
private List<SampleMessage> consumed = new CopyOnWriteArrayList<>();
List<SampleMessage> getConsumed() {
return this.consumed;

@ -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<SampleMessage> consumed = new ArrayList<>();
private List<SampleMessage> consumed = new CopyOnWriteArrayList<>();
List<SampleMessage> getConsumed() {
return this.consumed;

Loading…
Cancel
Save