Skip to content

Add @GuardedBy and remove redundant synchronized#105

Merged
bbakerman merged 1 commit into
graphql-java:masterfrom
dugenkui03:add_GuardedBy
Dec 27, 2021
Merged

Add @GuardedBy and remove redundant synchronized#105
bbakerman merged 1 commit into
graphql-java:masterfrom
dugenkui03:add_GuardedBy

Conversation

@dugenkui03
Copy link
Copy Markdown
Contributor

@dugenkui03 dugenkui03 commented Nov 17, 2021

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

}

CompletableFuture<V> loadCallFuture;
synchronized (dataLoader) {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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