File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -257,12 +257,12 @@ String getNamespace() {
257257 return _collection != null ? _collection .getFullName () : null ;
258258 }
259259
260- synchronized int getNumDocuments () {
260+ int getNumDocuments () {
261261 return _numDocuments ;
262262 }
263263
264264 @ Override
265- public synchronized int putObject (BSONObject o ) {
265+ public int putObject (BSONObject o ) {
266266 // check max size
267267 int objectSize = _encoder .writeObject (_buf , o );
268268 if (objectSize > Math .max (_mongo .getConnector ().getMaxBsonObjectSize (), Bytes .MAX_OBJECT_SIZE )) {
@@ -280,5 +280,5 @@ public synchronized int putObject(BSONObject o) {
280280 private final int _queryOptions ;
281281 private final DBObject _query ;
282282 private final DBEncoder _encoder ;
283- private int _numDocuments ;
283+ private volatile int _numDocuments ; // only one thread will modify this field, so volatile is sufficient synchronization
284284}
You can’t perform that action at this time.
0 commit comments