GH-9878: Fix ConcurrentModificationException in SpringIntegrationTest…#9879
GH-9878: Fix ConcurrentModificationException in SpringIntegrationTest…#9879artembilan merged 1 commit intospring-projects:mainfrom proggler23:GH-9878
Conversation
|
|
||
| List<AbstractEndpoint> getAutoStartupCandidates() { | ||
| return this.autoStartupCandidates; | ||
| return new ArrayList<>(this.autoStartupCandidates); |
There was a problem hiding this comment.
I think I'm OK with what you are suggesting, but this has to be like Collections.unmodifiableList() instead.
We indeed do like that in many other places where we return a collection from the object.
I missed this here because it is not public API, but as we see turns out it does not matter if we may deal with concurrent modifications. 😄
There was a problem hiding this comment.
ok, I was just not returning unmodifiableList to not break any user, who is in fact modifying. but you're right, it's not public anyways
| @SpringJUnitConfig | ||
| @ContextConfiguration(classes = MockIntegrationContextTests.Config.class) | ||
| @SpringIntegrationTest | ||
| public class MockIntegrationContextTests { |
There was a problem hiding this comment.
Let's just remove this new void class altogether!
I'm really not sure that registering beans in start()/stop() is OK idea, so I don't want to promote such a pattern with our tests.
Plus the fix is really simple and it is obvious that it is going to work in your project.
| import java.util.Arrays; | ||
| import java.util.Collection; | ||
| import java.util.List; | ||
| import java.util.*; |
There was a problem hiding this comment.
Sorry, no asterisk imports.
Also, please, add your name to the @author list of this class.
…ExecutionListener
Fixes: gh-9878
* return new list in MockIntegrationContext.getAutoStartupCandidates()
Signed-off-by: Alexander Hain <Alexander.hain@cloudflight.io>
|
thank you very much for the contribution; looking forward for more! |
…ExecutionListener