Skip to content

Commit e23a79e

Browse files
committed
use the socket factory from the Mongo for ReplicaSetStatus connections
1 parent 2c6ca10 commit e23a79e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/com/mongodb/ReplicaSetStatus.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public class ReplicaSetStatus {
5050
static final int UNAUTHENTICATED_ERROR_CODE = 10057;
5151

5252
ReplicaSetStatus( Mongo mongo, List<ServerAddress> initial ){
53+
_mongoOptions = _mongoOptionsDefaults.copy();
54+
_mongoOptions.socketFactory = mongo._options.socketFactory;
55+
5356
_mongo = mongo;
5457
_all = Collections.synchronizedList( new ArrayList<Node>() );
5558
for ( ServerAddress addr : initial ){
@@ -541,15 +544,16 @@ public int getMaxBsonObjectSize() {
541544
static int inetAddrCacheMS;
542545
static float latencySmoothFactor;
543546

544-
static final MongoOptions _mongoOptions = new MongoOptions();
547+
final MongoOptions _mongoOptions;
548+
static final MongoOptions _mongoOptionsDefaults = new MongoOptions();
545549

546550
static {
547551
updaterIntervalMS = Integer.parseInt(System.getProperty("com.mongodb.updaterIntervalMS", "5000"));
548552
slaveAcceptableLatencyMS = Integer.parseInt(System.getProperty("com.mongodb.slaveAcceptableLatencyMS", "15"));
549553
inetAddrCacheMS = Integer.parseInt(System.getProperty("com.mongodb.inetAddrCacheMS", "300000"));
550554
latencySmoothFactor = Float.parseFloat(System.getProperty("com.mongodb.latencySmoothFactor", "4"));
551-
_mongoOptions.connectTimeout = Integer.parseInt(System.getProperty("com.mongodb.updaterConnectTimeoutMS", "20000"));
552-
_mongoOptions.socketTimeout = Integer.parseInt(System.getProperty("com.mongodb.updaterSocketTimeoutMS", "20000"));
555+
_mongoOptionsDefaults.connectTimeout = Integer.parseInt(System.getProperty("com.mongodb.updaterConnectTimeoutMS", "20000"));
556+
_mongoOptionsDefaults.socketTimeout = Integer.parseInt(System.getProperty("com.mongodb.updaterSocketTimeoutMS", "20000"));
553557
}
554558

555559
static final DBObject _isMasterCmd = new BasicDBObject( "ismaster" , 1 );

0 commit comments

Comments
 (0)