@@ -138,10 +138,12 @@ public static ReadPreference nearest() {
138
138
/**
139
139
* Gets a read preference that forces reads to the primary if available, otherwise to a secondary.
140
140
*
141
- * @param maxStaleness the max allowable staleness of secondaries.
141
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
142
+ * plus 10 seconds, whichever is greatest.
142
143
* @param timeUnit the time unit of maxStaleness
143
144
* @return ReadPreference which reads primary if available.
144
145
* @since 3.4
146
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
145
147
*/
146
148
public static ReadPreference primaryPreferred (final long maxStaleness , final TimeUnit timeUnit ) {
147
149
return new PrimaryPreferredReadPreference (Collections .<TagSet >emptyList (), maxStaleness , timeUnit );
@@ -155,10 +157,12 @@ public static ReadPreference primaryPreferred(final long maxStaleness, final Tim
155
157
* and selects only those secondaries whose staleness is less than or equal to maxStaleness.
156
158
* </p>
157
159
*
158
- * @param maxStaleness the max allowable staleness of secondaries.
160
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
161
+ * plus 10 seconds, whichever is greatest.
159
162
* @param timeUnit the time unit of maxStaleness
160
163
* @return ReadPreference which reads secondary.
161
164
* @since 3.4
165
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
162
166
*/
163
167
public static ReadPreference secondary (final long maxStaleness , final TimeUnit timeUnit ) {
164
168
return new SecondaryReadPreference (Collections .<TagSet >emptyList (), maxStaleness , timeUnit );
@@ -172,10 +176,12 @@ public static ReadPreference secondary(final long maxStaleness, final TimeUnit t
172
176
* The driver estimates the staleness of each secondary, based on lastWriteDate values provided in server isMaster responses,
173
177
* and selects only those secondaries whose staleness is less than or equal to maxStaleness.
174
178
* </p> *
175
- * @param maxStaleness the max allowable staleness of secondaries.
179
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
180
+ * plus 10 seconds, whichever is greatest.
176
181
* @param timeUnit the time unit of maxStaleness
177
182
* @return ReadPreference which reads secondary if available, otherwise from primary.
178
183
* @since 3.4
184
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
179
185
*/
180
186
public static ReadPreference secondaryPreferred (final long maxStaleness , final TimeUnit timeUnit ) {
181
187
return new SecondaryPreferredReadPreference (Collections .<TagSet >emptyList (), maxStaleness , timeUnit );
@@ -189,10 +195,12 @@ public static ReadPreference secondaryPreferred(final long maxStaleness, final T
189
195
* and selects only those secondaries whose staleness is less than or equal to maxStaleness.
190
196
* </p>
191
197
*
192
- * @param maxStaleness the max allowable staleness of secondaries.
198
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
199
+ * plus 10 seconds, whichever is greatest.
193
200
* @param timeUnit the time unit of maxStaleness
194
201
* @return ReadPreference which reads nearest
195
202
* @since 3.4
203
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
196
204
*/
197
205
public static ReadPreference nearest (final long maxStaleness , final TimeUnit timeUnit ) {
198
206
return new NearestReadPreference (Collections .<TagSet >emptyList (), maxStaleness , timeUnit );
@@ -252,10 +260,12 @@ public static TaggableReadPreference nearest(final TagSet tagSet) {
252
260
* </p>
253
261
*
254
262
* @param tagSet the set of tags to limit the list of secondaries to.
255
- * @param maxStaleness the max allowable staleness of secondaries.
263
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
264
+ * plus 10 seconds, whichever is greatest.
256
265
* @param timeUnit the time unit of maxStaleness
257
266
* @return ReadPreference which reads primary if available, otherwise a secondary respective of tags.\
258
267
* @since 3.4
268
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
259
269
*/
260
270
public static TaggableReadPreference primaryPreferred (final TagSet tagSet ,
261
271
final long maxStaleness , final TimeUnit timeUnit ) {
@@ -271,10 +281,12 @@ public static TaggableReadPreference primaryPreferred(final TagSet tagSet,
271
281
* </p>
272
282
*
273
283
* @param tagSet the set of tags to limit the list of secondaries to
274
- * @param maxStaleness the max allowable staleness of secondaries.
284
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
285
+ * plus 10 seconds, whichever is greatest.
275
286
* @param timeUnit the time unit of maxStaleness
276
287
* @return ReadPreference which reads secondary respective of tags.
277
288
* @since 3.4
289
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
278
290
*/
279
291
public static TaggableReadPreference secondary (final TagSet tagSet ,
280
292
final long maxStaleness , final TimeUnit timeUnit ) {
@@ -290,10 +302,12 @@ public static TaggableReadPreference secondary(final TagSet tagSet,
290
302
* and selects only those secondaries whose staleness is less than or equal to maxStaleness.
291
303
* </p> *
292
304
* @param tagSet the set of tags to limit the list of secondaries to
293
- * @param maxStaleness the max allowable staleness of secondaries.
305
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
306
+ * plus 10 seconds, whichever is greatest.
294
307
* @param timeUnit the time unit of maxStaleness
295
308
* @return ReadPreference which reads secondary if available respective of tags, otherwise from primary irrespective of tags.
296
309
* @since 3.4
310
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
297
311
*/
298
312
public static TaggableReadPreference secondaryPreferred (final TagSet tagSet ,
299
313
final long maxStaleness , final TimeUnit timeUnit ) {
@@ -310,10 +324,12 @@ public static TaggableReadPreference secondaryPreferred(final TagSet tagSet,
310
324
* </p>
311
325
*
312
326
* @param tagSet the set of tags to limit the list of secondaries to
313
- * @param maxStaleness the max allowable staleness of secondaries.
327
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
328
+ * plus 10 seconds, whichever is greatest.
314
329
* @param timeUnit the time unit of maxStaleness
315
330
* @return ReadPreference which reads nearest node respective of tags.
316
331
* @since 3.4
332
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
317
333
*/
318
334
public static TaggableReadPreference nearest (final TagSet tagSet ,
319
335
final long maxStaleness , final TimeUnit timeUnit ) {
@@ -388,10 +404,12 @@ public static TaggableReadPreference nearest(final List<TagSet> tagSetList) {
388
404
* </p>
389
405
*
390
406
* @param tagSetList the list of tag sets to limit the list of secondaries to
391
- * @param maxStaleness the max allowable staleness of secondaries.
407
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
408
+ * plus 10 seconds, whichever is greatest.
392
409
* @param timeUnit the time unit of maxStaleness
393
410
* @return ReadPreference which reads primary if available, otherwise a secondary respective of tags.
394
411
* @since 3.4
412
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
395
413
*/
396
414
public static TaggableReadPreference primaryPreferred (final List <TagSet > tagSetList ,
397
415
final long maxStaleness , final TimeUnit timeUnit ) {
@@ -413,10 +431,12 @@ public static TaggableReadPreference primaryPreferred(final List<TagSet> tagSetL
413
431
* </p>
414
432
*
415
433
* @param tagSetList the list of tag sets to limit the list of secondaries to
416
- * @param maxStaleness the max allowable staleness of secondaries.
434
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
435
+ * plus 10 seconds, whichever is greatest.
417
436
* @param timeUnit the time unit of maxStaleness
418
437
* @return ReadPreference which reads secondary respective of tags.
419
438
* @since 3.4
439
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
420
440
*/
421
441
public static TaggableReadPreference secondary (final List <TagSet > tagSetList ,
422
442
final long maxStaleness , final TimeUnit timeUnit ) {
@@ -438,10 +458,12 @@ public static TaggableReadPreference secondary(final List<TagSet> tagSetList,
438
458
* </p>
439
459
*
440
460
* @param tagSetList the list of tag sets to limit the list of secondaries to
441
- * @param maxStaleness the max allowable staleness of secondaries.
461
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
462
+ * plus 10 seconds, whichever is greatest.
442
463
* @param timeUnit the time unit of maxStaleness
443
464
* @return ReadPreference which reads secondary if available respective of tags, otherwise from primary irrespective of tags.
444
465
* @since 3.4
466
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
445
467
*/
446
468
public static TaggableReadPreference secondaryPreferred (final List <TagSet > tagSetList ,
447
469
final long maxStaleness , final TimeUnit timeUnit ) {
@@ -463,10 +485,12 @@ public static TaggableReadPreference secondaryPreferred(final List<TagSet> tagSe
463
485
* </p>
464
486
*
465
487
* @param tagSetList the list of tag sets to limit the list of secondaries to
466
- * @param maxStaleness the max allowable staleness of secondaries.
488
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
489
+ * plus 10 seconds, whichever is greatest.
467
490
* @param timeUnit the time unit of maxStaleness
468
491
* @return ReadPreference which reads nearest node respective of tags.
469
492
* @since 3.4
493
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
470
494
*/
471
495
public static TaggableReadPreference nearest (final List <TagSet > tagSetList ,
472
496
final long maxStaleness , final TimeUnit timeUnit ) {
@@ -527,10 +551,12 @@ public static TaggableReadPreference valueOf(final String name, final List<TagSe
527
551
*
528
552
* @param name the name of the read preference
529
553
* @param tagSetList the list of tag sets
530
- * @param maxStaleness the max allowable staleness of secondaries.
554
+ * @param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
555
+ * plus 10 seconds, whichever is greatest.
531
556
* @param timeUnit the time unit of maxStaleness
532
557
* @return the taggable read preference
533
558
* @since 3.4
559
+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
534
560
*/
535
561
public static TaggableReadPreference valueOf (final String name , final List <TagSet > tagSetList , final long maxStaleness ,
536
562
final TimeUnit timeUnit ) {
0 commit comments