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 76c670075b)
This commit is contained in:
Artem Bilan
2018-11-07 10:42:00 -05:00
parent 0418b7cbdc
commit 6d523e2a70

View File

@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -168,7 +169,7 @@ public class RotatingServersTests extends FtpTestSupport {
private final CountDownLatch latch = new CountDownLatch(17);
List<Integer> sessionSources = new ArrayList<>();
final List<Integer> sessionSources = new CopyOnWriteArrayList<>();
@Bean
public SessionFactory<FTPFile> factory1() {