Browse Source

DATAMONGO-305 - Removed synchronization from Query class.

As Query is not intended to be thread-safe at all, we can safely remove the synchronized blocks from sort() and fields().
pull/1/head
Oliver Gierke 14 years ago
parent
commit
b26bb62a63
  1. 13
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java

13
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java

@ -63,10 +63,8 @@ public class Query { @@ -63,10 +63,8 @@ public class Query {
}
public Field fields() {
synchronized (this) {
if (fieldSpec == null) {
this.fieldSpec = new Field();
}
if (fieldSpec == null) {
this.fieldSpec = new Field();
}
return this.fieldSpec;
}
@ -82,11 +80,10 @@ public class Query { @@ -82,11 +80,10 @@ public class Query {
}
public Sort sort() {
synchronized (this) {
if (this.sort == null) {
this.sort = new Sort();
}
if (this.sort == null) {
this.sort = new Sort();
}
return this.sort;
}

Loading…
Cancel
Save