Skip to content

Add @GuardedBy and remove redundant synchronized #105

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

Merged
merged 1 commit into from
Dec 27, 2021

Conversation

dugenkui03
Copy link
Contributor

@dugenkui03 dugenkui03 commented Nov 17, 2021

As @GuardedBy("dataLoader") describe, the thread is already hold dataLoader lock when loadFromCache is called.

@@ -296,15 +298,12 @@ private void possiblyClearCacheEntriesOnExceptions(List<K> keys) {
return futureCache.get(cacheKey);
}

CompletableFuture<V> loadCallFuture;
synchronized (dataLoader) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a weird PR because you gave no explanation of why this synchronised call is not needed.

Are you sayin that a synchronized is already in place when this is called??

the loader queue is the key bit of mutable state in the DataLoader (the list of promises to get data at some future batch time) and hence needs synchronization of some sort.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is - explanation is important

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbakerman Thanks for your response.

Yes. As @GuardedBy("dataLoader") describe, the thread is already hold dataLoader lock when loadFromCache is called.

@dugenkui03 dugenkui03 requested a review from bbakerman November 18, 2021 04:05
@bbakerman bbakerman merged commit dd96e13 into graphql-java:master Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants