-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: prevent possible concurrent modification of a collection #1370
Conversation
core/src/main/java/ai/timefold/solver/core/impl/solver/BestSolutionHolder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/solver/BestSolutionHolder.java
Show resolved
Hide resolved
|
core/src/main/java/ai/timefold/solver/core/impl/solver/BestSolutionHolder.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes have simplified the class's logic and look great to me!
We have seen reports of the TreeMap getting concurrently accessed and throwing exceptions. Unfortunately, we have never seen any code to reproduce these failures, as concurrency issues are notoriously hard to reproduce. Therefore we refactor the mechanism to make any such issues impossible. For the same reason as there is no reproducer, there is also no new test coverage. But existing test coverage still passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that a part of locking has been replaced by immutability, that's nice.
We have seen reports of the TreeMap getting concurrently accessed and throwing exceptions. Unfortunately, we have never seen any code to reproduce these failures, as concurrency issues are notoriously hard to reproduce. Therefore we refactor the mechanism to make any such issues impossible.
For the same reason as there is no reproducer, there is also no new test coverage. But existing test coverage still passes.