Skip to content

Commit 6d523e2

Browse files
committed
Fix RotatingServersTests concurrency
https://build.spring.io/browse/INT-FATS5IC-685/ Even if we stop `SourcePollingChannelAdapter`, the task on the fly is still going to be executed. This way we may have extra calls to our logic. * Use `CopyOnWriteArrayList` for the `sessionSources` to avoid `ConcurrentModificationException` during this collection read in the tests **Cherry-pick to 5.0.x** (cherry picked from commit 76c6700)
1 parent 0418b7c commit 6d523e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.io.File;
2323
import java.util.ArrayList;
2424
import java.util.List;
25+
import java.util.concurrent.CopyOnWriteArrayList;
2526
import java.util.concurrent.CountDownLatch;
2627
import java.util.concurrent.TimeUnit;
2728
import java.util.stream.Collectors;
@@ -168,7 +169,7 @@ public static class StandardConfig {
168169

169170
private final CountDownLatch latch = new CountDownLatch(17);
170171

171-
List<Integer> sessionSources = new ArrayList<>();
172+
final List<Integer> sessionSources = new CopyOnWriteArrayList<>();
172173

173174
@Bean
174175
public SessionFactory<FTPFile> factory1() {

0 commit comments

Comments
 (0)