Wrap LinkedList manipulations into synchronized

https://build.spring.io/browse/INT-MASTER-1017

Looks like non-`volatile` `size` property in the `LinkedList` is not
updated properly for the `contains()` assertion, therefore we end up
with the `ConcurrentModificationException`

* Move `assertThat()` into the `synchronized (overridePresent)` block
to enforce CPU cache flushing and, therefore, have an actual value
for the `LinkedList.size` during iteration
This commit is contained in:
Artem Bilan
2018-05-04 12:50:37 -04:00
parent e98738788d
commit 4fd638e321

View File

@@ -311,8 +311,8 @@ public class PollerAdviceTests {
while (overridePresent.size() > 5) {
overridePresent.removeLast();
}
assertThat(overridePresent, contains(null, override, null, override, null));
}
assertThat(overridePresent, contains(null, override, null, override, null));
verify(override, atLeast(2)).nextExecutionTime(any(TriggerContext.class));
}