@@ -655,13 +655,13 @@ public final DBObject findOne( DBObject o, DBObject fields, ReadPreference readP
655
655
// Only create a new decoder if there is a decoder factory explicitly set on the collection. Otherwise return null
656
656
// so that DBPort will use a cached decoder from the default factory.
657
657
private DBDecoder getDecoder () {
658
- return _decoderFactory != null ? _decoderFactory .create () : null ;
658
+ return getDBDecoderFactory () != null ? getDBDecoderFactory () .create () : null ;
659
659
}
660
660
661
661
// Only create a new encoder if there is an encoder factory explicitly set on the collection. Otherwise return null
662
662
// to allow DB to create its own or use a cached one.
663
663
private DBEncoder getDBEncoder () {
664
- return _encoderFactory != null ? _encoderFactory .create () : null ;
664
+ return getDBEncoderFactory () != null ? getDBEncoderFactory () .create () : null ;
665
665
}
666
666
667
667
@@ -1429,7 +1429,7 @@ public int getOptions(){
1429
1429
* Set a customer decoder factory for this collection. Set to null to use the default from MongoOptions.
1430
1430
* @param fact the factory to set.
1431
1431
*/
1432
- public void setDBDecoderFactory (DBDecoderFactory fact ) {
1432
+ public synchronized void setDBDecoderFactory (DBDecoderFactory fact ) {
1433
1433
_decoderFactory = fact ;
1434
1434
}
1435
1435
@@ -1438,15 +1438,15 @@ public void setDBDecoderFactory(DBDecoderFactory fact) {
1438
1438
* is being used.
1439
1439
* @return the factory
1440
1440
*/
1441
- public DBDecoderFactory getDBDecoderFactory () {
1441
+ public synchronized DBDecoderFactory getDBDecoderFactory () {
1442
1442
return _decoderFactory ;
1443
1443
}
1444
1444
1445
1445
/**
1446
1446
* Set a customer encoder factory for this collection. Set to null to use the default from MongoOptions.
1447
1447
* @param fact the factory to set.
1448
1448
*/
1449
- public void setDBEncoderFactory (DBEncoderFactory fact ) {
1449
+ public synchronized void setDBEncoderFactory (DBEncoderFactory fact ) {
1450
1450
_encoderFactory = fact ;
1451
1451
}
1452
1452
@@ -1455,7 +1455,7 @@ public void setDBEncoderFactory(DBEncoderFactory fact) {
1455
1455
* is being used.
1456
1456
* @return the factory
1457
1457
*/
1458
- public DBEncoderFactory getDBEncoderFactory () {
1458
+ public synchronized DBEncoderFactory getDBEncoderFactory () {
1459
1459
return _encoderFactory ;
1460
1460
}
1461
1461
0 commit comments