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:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user