Skip to content
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

Remove synchronized(this) from sort() and fields() methods in the Query class [DATAMONGO-305] #1236

Closed
spring-projects-issues opened this issue Oct 26, 2011 · 0 comments
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Oct 26, 2011

Adam Rinehart opened DATAMONGO-305 and commented

In the org.springframework.data.mongodb.core.query.Query class, the sort() and fields() methods are synchronizing on this, before initializing and returning the sort and fields attributes.

But in addCriteria(), it is making unsynchronized access to a LinkedHashMap to store the criteria in. Because of this, it seems like this class is not intended to be thread-safe.

Using synchronized in a class that is not thread-safe can cause a performance bottleneck, and should be removed


Affects: 1.0 M5

Reference URL: http://forum.springsource.org/showthread.php?116411-Mongo-Query-object-why-are-sort()-amp-fields()-synchronized

Attachments:

Referenced from: commits b26bb62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants