Commit 1c86c2f9 by jinfeng.wang

fix

parent f1d407a0
......@@ -2,6 +2,7 @@ package com.mobvista.apptag.utils;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.ReadPreference;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
......@@ -26,7 +27,10 @@ public class GetPackageFromMongo {
try {
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
// build the connection options,set the max wait time in (ms)
builder.maxConnectionIdleTime(300000);
builder.readPreference(ReadPreference.primaryPreferred())
.retryWrites(true)
.maxConnectionIdleTime(6000)
.sslEnabled(true);
MongoClientOptions opts = builder.build();
// MongoCredential credential2 = MongoCredential.createCredential("username", "databasename",password2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment