File tree 1 file changed +6
-0
lines changed
src/main/java/org/vertx/mods
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ public class MongoPersistor extends BusModBase implements Handler<Message<JsonOb
42
42
protected String dbName ;
43
43
protected String username ;
44
44
protected String password ;
45
+ protected boolean autoConnectRetry ;
46
+ protected int socketTimeout ;
45
47
46
48
protected Mongo mongo ;
47
49
protected DB db ;
@@ -57,10 +59,14 @@ public void start() {
57
59
username = getOptionalStringConfig ("username" , null );
58
60
password = getOptionalStringConfig ("password" , null );
59
61
int poolSize = getOptionalIntConfig ("pool_size" , 10 );
62
+ autoConnectRetry = getOptionalBooleanConfig ("autoConnectRetry" , true );
63
+ socketTimeout = getOptionalIntConfig ("socketTimeout" , 60000 );
60
64
61
65
try {
62
66
MongoClientOptions .Builder builder = new MongoClientOptions .Builder ();
63
67
builder .connectionsPerHost (poolSize );
68
+ builder .autoConnectRetry (autoConnectRetry );
69
+ builder .socketTimeout (socketTimeout );
64
70
ServerAddress address = new ServerAddress (host , port );
65
71
mongo = new MongoClient (address , builder .build ());
66
72
db = mongo .getDB (dbName );
You can’t perform that action at this time.
0 commit comments