-
Notifications
You must be signed in to change notification settings - Fork 227
Fix for multi threading issues in AnnotationMap #3397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix for multi threading issues in AnnotationMap #3397
Conversation
/ writes could happen in multiple threads. - changed execution order, to be able to synchronize only necessary code blocks. - Removed dead code in AnnotationModel.cleanup because mapLock can't be null. - Added new javadoc to IAnnotationMap.getLockObject(). - added assert.isLegal check to AnnotationMAp.setLockObject()
@mehmet-karaman can you please more explain the rationale behind the changes? I think we can assume code is there for a reason so if we change fundamental things we should carefully describe the reasons and causes and why it is not a bug of the caller for example as otherwise we might run into deadlocks if code that previously run outside locks now run under lock conditions. |
The change here is coming from eclipse-xtext/xtext#3524 investigation. |
@szarnekow : if you have time, would be good if you could check this PR. |
It still would be good to more explain the individual changes and why they are required / needed. Also I think some changes are better a separate PR (as they are easier to review then e.g. "Removed dead code" or API documentation enhancements) |
Could you please point which exactly? |
Each of those can be an own PR
All of these seem independent and local enough to be quickly reviewed and merged and likely will improve things without risk for regression. And even if they are easier to revert in isolation. Then might be the next thing
and finally
This will make each PR small, focused and likely better to understand the implications and its easier to write a concise commit message. |
*/ | ||
protected void removeAllAnnotations(boolean fireModelChanged) { | ||
if (fDocument == null) { | ||
return; |
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 believe we should remove this check completely to make sure model is "cleaned up".
removePosition(fDocument, position);
already checks for the document not being null, so it should be fine.
I believe these could be seperated from the main PR, but should go in one PR, because they all require each other. |
Sure at laest I think these are more "cleanup" and currently make the PR harder to review than it should. |
Uh oh!
There was an error while loading. Please reload this page.