Skip to content

Commit

Permalink
ATS-20
Browse files Browse the repository at this point in the history
  • Loading branch information
madness-inc committed Nov 11, 2019
1 parent ee1ccc7 commit 09ef479
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/org/appng/tomcat/session/mongo/MongoStore.java
Expand Up @@ -190,6 +190,15 @@ public class MongoStore extends StoreBase {
/** The socket timeout when connecting to a MongoDB server */
private int socketTimeout = 10000;

/**
* Sets the server selection timeout in milliseconds, which defines how long the driver will wait for server
* selection to succeed before throwing an exception.
*/
private int serverSelectionTimeout = 30000;

/** Sets whether writes should be retried if they fail due to a network error. */
private boolean retryWrites = false;

/**
* Retrieve the unique Context name for this Manager. This will be used to separate out sessions from different
* application Contexts.
Expand Down Expand Up @@ -487,6 +496,7 @@ private void getConnection() throws LifecycleException {
}
MongoClientOptions options = MongoClientOptions.builder().connectTimeout(connectionTimeoutMs)
.maxWaitTime(connectionWaitTimeoutMs).connectionsPerHost(maxPoolSize).writeConcern(writeConcern)
.serverSelectionTimeout(serverSelectionTimeout).retryWrites(retryWrites)
.readPreference(readPreference).readConcern(readConcern).requiredReplicaSetName(replicaSet)
.socketTimeout(socketTimeout).build();

Expand Down

0 comments on commit 09ef479

Please sign in to comment.