|
1 | 1 | /* |
2 | | - * Copyright 2024 the original author or authors. |
| 2 | + * Copyright 2024-2025 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -598,9 +598,9 @@ static class TestTopicListener0 { |
598 | 598 | @Autowired |
599 | 599 | CountDownLatchContainer container; |
600 | 600 |
|
601 | | - private final List<String> receivedMsgs = new ArrayList<>(); |
| 601 | + private final List<String> receivedMsgs = Collections.synchronizedList(new ArrayList<>()); |
602 | 602 |
|
603 | | - private final List<String> receivedTopics = new ArrayList<>(); |
| 603 | + private final List<String> receivedTopics = Collections.synchronizedList(new ArrayList<>()); |
604 | 604 |
|
605 | 605 | @KafkaHandler |
606 | 606 | public Mono<Void> listen(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String receivedTopic) { |
@@ -630,9 +630,9 @@ static class TestTopicListener1 { |
630 | 630 | @Autowired |
631 | 631 | CountDownLatchContainer container; |
632 | 632 |
|
633 | | - private final List<String> receivedMsgs = new ArrayList<>(); |
| 633 | + private final List<String> receivedMsgs = Collections.synchronizedList(new ArrayList<>()); |
634 | 634 |
|
635 | | - private final List<String> receivedTopics = new ArrayList<>(); |
| 635 | + private final List<String> receivedTopics = Collections.synchronizedList(new ArrayList<>()); |
636 | 636 |
|
637 | 637 | private CountDownLatch firstRetryFailMsgLatch = new CountDownLatch(1); |
638 | 638 |
|
@@ -687,9 +687,9 @@ static class TestTopicListener2 { |
687 | 687 | @Autowired |
688 | 688 | CountDownLatchContainer container; |
689 | 689 |
|
690 | | - protected final List<String> receivedMsgs = new ArrayList<>(); |
| 690 | + protected final List<String> receivedMsgs = Collections.synchronizedList(new ArrayList<>()); |
691 | 691 |
|
692 | | - private final List<String> receivedTopics = new ArrayList<>(); |
| 692 | + private final List<String> receivedTopics = Collections.synchronizedList(new ArrayList<>()); |
693 | 693 |
|
694 | 694 | private CountDownLatch firstRetryFailMsgLatch = new CountDownLatch(1); |
695 | 695 |
|
@@ -746,9 +746,9 @@ static class TestTopicListener3 { |
746 | 746 | @Autowired |
747 | 747 | CountDownLatchContainer container; |
748 | 748 |
|
749 | | - protected final List<String> receivedMsgs = new ArrayList<>(); |
| 749 | + protected final List<String> receivedMsgs = Collections.synchronizedList(new ArrayList<>()); |
750 | 750 |
|
751 | | - private final List<String> receivedTopics = new ArrayList<>(); |
| 751 | + private final List<String> receivedTopics = Collections.synchronizedList(new ArrayList<>()); |
752 | 752 |
|
753 | 753 | public static final String FAIL_PREFIX = "fail"; |
754 | 754 |
|
@@ -811,9 +811,9 @@ static class TestTopicListener4 { |
811 | 811 | @Autowired |
812 | 812 | CountDownLatchContainer container; |
813 | 813 |
|
814 | | - protected final List<String> receivedMsgs = new ArrayList<>(); |
| 814 | + protected final List<String> receivedMsgs = Collections.synchronizedList(new ArrayList<>()); |
815 | 815 |
|
816 | | - private final List<String> receivedTopics = new ArrayList<>(); |
| 816 | + private final List<String> receivedTopics = Collections.synchronizedList(new ArrayList<>()); |
817 | 817 |
|
818 | 818 | public static final String LONG_SUCCESS_MSG = "success"; |
819 | 819 |
|
@@ -877,9 +877,9 @@ static class TestTopicListener5 { |
877 | 877 | @Autowired |
878 | 878 | CountDownLatchContainer container; |
879 | 879 |
|
880 | | - protected final List<String> receivedMsgs = new ArrayList<>(); |
| 880 | + protected final List<String> receivedMsgs = Collections.synchronizedList(new ArrayList<>()); |
881 | 881 |
|
882 | | - private final List<String> receivedTopics = new ArrayList<>(); |
| 882 | + private final List<String> receivedTopics = Collections.synchronizedList(new ArrayList<>()); |
883 | 883 |
|
884 | 884 | public static final String LONG_SUCCESS_MSG = "success"; |
885 | 885 |
|
@@ -943,9 +943,9 @@ static class TestTopicListener6 { |
943 | 943 | @Autowired |
944 | 944 | CountDownLatchContainer container; |
945 | 945 |
|
946 | | - protected final List<String> receivedMsgs = new ArrayList<>(); |
| 946 | + protected final List<String> receivedMsgs = Collections.synchronizedList(new ArrayList<>()); |
947 | 947 |
|
948 | | - private final List<String> receivedTopics = new ArrayList<>(); |
| 948 | + private final List<String> receivedTopics = Collections.synchronizedList(new ArrayList<>()); |
949 | 949 |
|
950 | 950 | public static final String SUCCESS_PREFIX = "success"; |
951 | 951 |
|
@@ -1076,7 +1076,7 @@ static class CountDownLatchContainer { |
1076 | 1076 |
|
1077 | 1077 | static class MyCustomDltProcessor { |
1078 | 1078 |
|
1079 | | - final List<String> receivedMsg = new ArrayList<>(); |
| 1079 | + final List<String> receivedMsg = Collections.synchronizedList(new ArrayList<>()); |
1080 | 1080 |
|
1081 | 1081 | MyCustomDltProcessor(KafkaTemplate<String, String> kafkaTemplate, CountDownLatch latch) { |
1082 | 1082 | this.kafkaTemplate = kafkaTemplate; |
|
0 commit comments