@@ -138,10 +138,12 @@ public static ReadPreference nearest() {
138138 /**
139139 * Gets a read preference that forces reads to the primary if available, otherwise to a secondary.
140140 *
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.
142143 * @param timeUnit the time unit of maxStaleness
143144 * @return ReadPreference which reads primary if available.
144145 * @since 3.4
146+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
145147 */
146148 public static ReadPreference primaryPreferred (final long maxStaleness , final TimeUnit timeUnit ) {
147149 return new PrimaryPreferredReadPreference (Collections .<TagSet >emptyList (), maxStaleness , timeUnit );
@@ -155,10 +157,12 @@ public static ReadPreference primaryPreferred(final long maxStaleness, final Tim
155157 * and selects only those secondaries whose staleness is less than or equal to maxStaleness.
156158 * </p>
157159 *
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.
159162 * @param timeUnit the time unit of maxStaleness
160163 * @return ReadPreference which reads secondary.
161164 * @since 3.4
165+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
162166 */
163167 public static ReadPreference secondary (final long maxStaleness , final TimeUnit timeUnit ) {
164168 return new SecondaryReadPreference (Collections .<TagSet >emptyList (), maxStaleness , timeUnit );
@@ -172,10 +176,12 @@ public static ReadPreference secondary(final long maxStaleness, final TimeUnit t
172176 * The driver estimates the staleness of each secondary, based on lastWriteDate values provided in server isMaster responses,
173177 * and selects only those secondaries whose staleness is less than or equal to maxStaleness.
174178 * </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.
176181 * @param timeUnit the time unit of maxStaleness
177182 * @return ReadPreference which reads secondary if available, otherwise from primary.
178183 * @since 3.4
184+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
179185 */
180186 public static ReadPreference secondaryPreferred (final long maxStaleness , final TimeUnit timeUnit ) {
181187 return new SecondaryPreferredReadPreference (Collections .<TagSet >emptyList (), maxStaleness , timeUnit );
@@ -189,10 +195,12 @@ public static ReadPreference secondaryPreferred(final long maxStaleness, final T
189195 * and selects only those secondaries whose staleness is less than or equal to maxStaleness.
190196 * </p>
191197 *
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.
193200 * @param timeUnit the time unit of maxStaleness
194201 * @return ReadPreference which reads nearest
195202 * @since 3.4
203+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
196204 */
197205 public static ReadPreference nearest (final long maxStaleness , final TimeUnit timeUnit ) {
198206 return new NearestReadPreference (Collections .<TagSet >emptyList (), maxStaleness , timeUnit );
@@ -252,10 +260,12 @@ public static TaggableReadPreference nearest(final TagSet tagSet) {
252260 * </p>
253261 *
254262 * @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.
256265 * @param timeUnit the time unit of maxStaleness
257266 * @return ReadPreference which reads primary if available, otherwise a secondary respective of tags.\
258267 * @since 3.4
268+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
259269 */
260270 public static TaggableReadPreference primaryPreferred (final TagSet tagSet ,
261271 final long maxStaleness , final TimeUnit timeUnit ) {
@@ -271,10 +281,12 @@ public static TaggableReadPreference primaryPreferred(final TagSet tagSet,
271281 * </p>
272282 *
273283 * @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.
275286 * @param timeUnit the time unit of maxStaleness
276287 * @return ReadPreference which reads secondary respective of tags.
277288 * @since 3.4
289+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
278290 */
279291 public static TaggableReadPreference secondary (final TagSet tagSet ,
280292 final long maxStaleness , final TimeUnit timeUnit ) {
@@ -290,10 +302,12 @@ public static TaggableReadPreference secondary(final TagSet tagSet,
290302 * and selects only those secondaries whose staleness is less than or equal to maxStaleness.
291303 * </p> *
292304 * @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.
294307 * @param timeUnit the time unit of maxStaleness
295308 * @return ReadPreference which reads secondary if available respective of tags, otherwise from primary irrespective of tags.
296309 * @since 3.4
310+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
297311 */
298312 public static TaggableReadPreference secondaryPreferred (final TagSet tagSet ,
299313 final long maxStaleness , final TimeUnit timeUnit ) {
@@ -310,10 +324,12 @@ public static TaggableReadPreference secondaryPreferred(final TagSet tagSet,
310324 * </p>
311325 *
312326 * @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.
314329 * @param timeUnit the time unit of maxStaleness
315330 * @return ReadPreference which reads nearest node respective of tags.
316331 * @since 3.4
332+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
317333 */
318334 public static TaggableReadPreference nearest (final TagSet tagSet ,
319335 final long maxStaleness , final TimeUnit timeUnit ) {
@@ -388,10 +404,12 @@ public static TaggableReadPreference nearest(final List<TagSet> tagSetList) {
388404 * </p>
389405 *
390406 * @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.
392409 * @param timeUnit the time unit of maxStaleness
393410 * @return ReadPreference which reads primary if available, otherwise a secondary respective of tags.
394411 * @since 3.4
412+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
395413 */
396414 public static TaggableReadPreference primaryPreferred (final List <TagSet > tagSetList ,
397415 final long maxStaleness , final TimeUnit timeUnit ) {
@@ -413,10 +431,12 @@ public static TaggableReadPreference primaryPreferred(final List<TagSet> tagSetL
413431 * </p>
414432 *
415433 * @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.
417436 * @param timeUnit the time unit of maxStaleness
418437 * @return ReadPreference which reads secondary respective of tags.
419438 * @since 3.4
439+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
420440 */
421441 public static TaggableReadPreference secondary (final List <TagSet > tagSetList ,
422442 final long maxStaleness , final TimeUnit timeUnit ) {
@@ -438,10 +458,12 @@ public static TaggableReadPreference secondary(final List<TagSet> tagSetList,
438458 * </p>
439459 *
440460 * @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.
442463 * @param timeUnit the time unit of maxStaleness
443464 * @return ReadPreference which reads secondary if available respective of tags, otherwise from primary irrespective of tags.
444465 * @since 3.4
466+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
445467 */
446468 public static TaggableReadPreference secondaryPreferred (final List <TagSet > tagSetList ,
447469 final long maxStaleness , final TimeUnit timeUnit ) {
@@ -463,10 +485,12 @@ public static TaggableReadPreference secondaryPreferred(final List<TagSet> tagSe
463485 * </p>
464486 *
465487 * @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.
467490 * @param timeUnit the time unit of maxStaleness
468491 * @return ReadPreference which reads nearest node respective of tags.
469492 * @since 3.4
493+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
470494 */
471495 public static TaggableReadPreference nearest (final List <TagSet > tagSetList ,
472496 final long maxStaleness , final TimeUnit timeUnit ) {
@@ -527,10 +551,12 @@ public static TaggableReadPreference valueOf(final String name, final List<TagSe
527551 *
528552 * @param name the name of the read preference
529553 * @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.
531556 * @param timeUnit the time unit of maxStaleness
532557 * @return the taggable read preference
533558 * @since 3.4
559+ * @see TaggableReadPreference#getMaxStaleness(TimeUnit)
534560 */
535561 public static TaggableReadPreference valueOf (final String name , final List <TagSet > tagSetList , final long maxStaleness ,
536562 final TimeUnit timeUnit ) {
0 commit comments