Skip to content

Commit 4fd638e

Browse files
committed
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
1 parent e987387 commit 4fd638e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollerAdviceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ public void testCompoundTriggerAdvice() throws Exception {
311311
while (overridePresent.size() > 5) {
312312
overridePresent.removeLast();
313313
}
314+
assertThat(overridePresent, contains(null, override, null, override, null));
314315
}
315-
assertThat(overridePresent, contains(null, override, null, override, null));
316316
verify(override, atLeast(2)).nextExecutionTime(any(TriggerContext.class));
317317
}
318318

0 commit comments

Comments
 (0)