@@ -64,100 +64,99 @@ else if (safe)
64
64
public String description ;
65
65
66
66
/**
67
- * <p>The number of connections allowed per host
68
- * (the pool size, per host)</p>
69
- * <p>Once the pool is exhausted, this will block.
67
+ * The maximum number of connections allowed per host for this Mongo instance.
68
+ * Those connections will be kept in a pool when idle.
69
+ * Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection.
70
+ * Default is 10.
70
71
* @see {@linkplain MongoOptions#threadsAllowedToBlockForConnectionMultiplier}</p>
71
72
*/
72
73
public int connectionsPerHost ;
73
74
74
75
/**
75
- * multiplier for connectionsPerHost for # of threads that
76
- * can block if connectionsPerHost is 10, and
77
- * threadsAllowedToBlockForConnectionMultiplier is 5,
78
- * then 50 threads can block
79
- * more than that and an exception will be throw
76
+ * this multiplier, multiplied with the connectionsPerHost setting, gives the maximum number of threads that
77
+ * may be waiting for a connection to become available from the pool.
78
+ * All further threads will get an exception right away.
79
+ * For example if connectionsPerHost is 10 and threadsAllowedToBlockForConnectionMultiplier is 5, then up to 50 threads can wait for a connection.
80
+ * Default is 5.
80
81
*/
81
82
public int threadsAllowedToBlockForConnectionMultiplier ;
82
83
83
84
/**
84
- * The max wait time for a blocking thread for a connection from the pool in ms.
85
+ * The maximum wait time in ms that a thread may wait for a connection to become available.
86
+ * Default is 120,000.
85
87
*/
86
88
public int maxWaitTime ;
87
89
88
90
/**
89
- * The connection timeout in milliseconds; this is for
90
- * establishing the socket connections (open).
91
- * 0 is default and infinite
91
+ * The connection timeout in milliseconds.
92
+ * It is used solely when establishing a new connection {@link java.net.Socket#connect(java.net.SocketAddress, int) }
93
+ * Default is 0 and means no timeout.
92
94
*/
93
95
public int connectTimeout ;
94
96
95
97
/**
96
- * The socket timeout; this value is passed to
97
- * {@link java.net.Socket#setSoTimeout(int)}.
98
- * 0 is default and infinite
98
+ * The socket timeout in milliseconds
99
+ * It is used for I/O socket read and write operations {@link java.net.Socket#setSoTimeout(int)}
100
+ * Default is 0 and means no timeout.
99
101
*/
100
102
public int socketTimeout ;
101
103
102
104
/**
103
- * This controls whether or not to have socket keep alive
104
- * turned on (SO_KEEPALIVE).
105
- *
106
- * defaults to false
105
+ * This flag controls the socket keep alive feature that keeps a connection alive through firewalls {@link java.net.Socket#setKeepAlive(boolean)}
106
+ * Default is false.
107
107
*/
108
108
public boolean socketKeepAlive ;
109
109
110
110
/**
111
- * This controls whether the system retries automatically
112
- * on connection errors.
113
- * defaults to false
111
+ * If true, the driver will keep trying to connect to the server in case that the socket cannot be established.
112
+ * This can be useful to avoid exceptions being thrown when a server is down temporarily by blocking the operations.
113
+ * Note that it is not a good solution for many applications because:
114
+ * - in general infinite retries is not advised, the application can get stuck in case of long server down time
115
+ * - for a replica set, the driver will keep trying to connect to the same host, even if the master has changed
116
+ * - this does not apply to read/write exceptions on the socket
117
+ *
118
+ * For most applications it is advised to keep this setting off and handle exceptions properly in the application.
119
+ * The driver already has mechanisms to automatically recreate dead connections and retry read operations.
120
+ * Default is false.
114
121
*/
115
122
public boolean autoConnectRetry ;
116
123
117
124
/**
118
- * Specifies if the driver is allowed to read from secondaries
119
- * or slaves.
120
- *
121
- * defaults to false
125
+ * This flag specifies if the driver is allowed to read from secondary (slave) servers.
126
+ * Specifically in the current implementation, the driver will avoid reading from the primary server and round robin requests to secondaries.
127
+ * Driver also factors in the latency to secondaries when choosing a server.
128
+ * Note that reading from secondaries can increase performance and reliability, but it may result in temporary inconsistent results.
129
+ * Default is false.
122
130
*/
123
131
public boolean slaveOk ;
124
132
125
133
/**
126
- * Override the DBCallback factory. Default is for the standard Mongo Java
127
- * driver configuration.
134
+ * Override the DBCallback factory. Default is for the standard Mongo Java driver configuration.
128
135
*/
129
136
public DBDecoderFactory dbDecoderFactory ;
130
137
131
138
/**
132
- * If <b>true</b> the driver sends a getLastError command after
133
- * every update to ensure it succeeded (see also w and wtimeout)
134
- * If <b>false</b>, the driver does not send a getlasterror command
135
- * after every update.
136
- *
137
- * defaults to false
139
+ * If <b>true</b> the driver will use a WriteConcern of WriteConcern.SAFE for all operations.
140
+ * If w, wtimeout, fsync or j are specified, this setting is ignored.
141
+ * Default is false.
138
142
*/
139
143
public boolean safe ;
140
144
141
145
/**
142
- * If set, the w value of WriteConcern for the connection is set
143
- * to this.
144
- *
145
- * Defaults to 0; implies safe = true
146
+ * The "w" value of the global WriteConcern.
147
+ * Default is 0.
146
148
*/
147
149
public int w ;
148
150
149
151
/**
150
- * If set, the wtimeout value of WriteConcern for the
151
- * connection is set to this.
152
- *
153
- * Defaults to 0; implies safe = true
152
+ * The "wtimeout" value of the global WriteConcern.
153
+ * Default is 0.
154
154
*/
155
155
public int wtimeout ;
156
156
157
157
/**
158
- * Sets the fsync value of WriteConcern for the connection.
159
- *
160
- * Defaults to false; implies safe = true
158
+ * The "fsync" value of the global WriteConcern.
159
+ * Default is false.
161
160
*/
162
161
public boolean fsync ;
163
162
0 commit comments