Commit 2823d8d
committed
Fix race condition in the
The test fails sporadically like:
```
java.lang.AssertionError:
Expecting actual:
["bar", null, "baz"]
to contain exactly in any order:
["foo", null, "bar", "baz"]
but could not find the following elements:
["foo"]
```
That means the `listener.latch` is fulfilled, but `ArrayList` state is not deterministic
due to different threads interacting with this collection.
* Wrap `listener.deOptionaled` into a `Collections.synchronizedList()`
and use `synchronized (listener.deOptionaled) {` around assert command.OptionalPayloadTests
1 parent 15a6321 commit 2823d8d
File tree
1 file changed
+6
-2
lines changed- spring-rabbit/src/test/java/org/springframework/amqp/rabbit/annotation
1 file changed
+6
-2
lines changedLines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| |||
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
129 | | - | |
| 133 | + | |
130 | 134 | | |
131 | 135 | | |
132 | 136 | | |
| |||
0 commit comments