@@ -54,13 +54,15 @@ public abstract class TaggableReadPreference extends ReadPreference {
54
54
55
55
private final List <TagSet > tagSetList = new ArrayList <>();
56
56
private final Long maxStalenessMS ;
57
+ @ SuppressWarnings ("deprecation" )
57
58
private final ReadPreferenceHedgeOptions hedgeOptions ;
58
59
59
60
TaggableReadPreference () {
60
61
this .maxStalenessMS = null ;
61
62
this .hedgeOptions = null ;
62
63
}
63
64
65
+ @ SuppressWarnings ("deprecation" )
64
66
TaggableReadPreference (final List <TagSet > tagSetList , @ Nullable final Long maxStaleness , final TimeUnit timeUnit ,
65
67
@ Nullable final ReadPreferenceHedgeOptions hedgeOptions ) {
66
68
notNull ("tagSetList" , tagSetList );
@@ -80,6 +82,7 @@ public abstract class TaggableReadPreference extends ReadPreference {
80
82
@ Override
81
83
public abstract TaggableReadPreference withMaxStalenessMS (Long maxStalenessMS , TimeUnit timeUnit );
82
84
85
+ @ Deprecated
83
86
@ Override
84
87
public abstract TaggableReadPreference withHedgeOptions (ReadPreferenceHedgeOptions hedgeOptions );
85
88
@@ -146,7 +149,9 @@ public Long getMaxStaleness(final TimeUnit timeUnit) {
146
149
* @return the hedge options
147
150
* @mongodb.server.release 4.4
148
151
* @since 4.1
152
+ * @deprecated As of MongoDB 8.1, the server ignores the option and periodically logs a warning
149
153
*/
154
+ @ Deprecated
150
155
@ Nullable
151
156
public ReadPreferenceHedgeOptions getHedgeOptions () {
152
157
return hedgeOptions ;
@@ -327,6 +332,7 @@ static class SecondaryReadPreference extends TaggableReadPreference {
327
332
this (tagSetList , maxStaleness , timeUnit , null );
328
333
}
329
334
335
+ @ SuppressWarnings ("deprecation" )
330
336
SecondaryReadPreference (final List <TagSet > tagSetList , @ Nullable final Long maxStaleness , final TimeUnit timeUnit ,
331
337
@ Nullable final ReadPreferenceHedgeOptions hedgeOptions ) {
332
338
super (tagSetList , maxStaleness , timeUnit , hedgeOptions );
@@ -349,6 +355,7 @@ public TaggableReadPreference withMaxStalenessMS(@Nullable final Long maxStalene
349
355
return new SecondaryReadPreference (getTagSetList (), maxStaleness , timeUnit , getHedgeOptions ());
350
356
}
351
357
358
+ @ Deprecated
352
359
@ Override
353
360
public TaggableReadPreference withHedgeOptions (final ReadPreferenceHedgeOptions hedgeOptions ) {
354
361
return new SecondaryReadPreference (getTagSetList (), getMaxStaleness (MILLISECONDS ), MILLISECONDS , hedgeOptions );
@@ -388,6 +395,7 @@ static class SecondaryPreferredReadPreference extends SecondaryReadPreference {
388
395
this (tagSetList , maxStaleness , timeUnit , null );
389
396
}
390
397
398
+ @ SuppressWarnings ("deprecation" )
391
399
SecondaryPreferredReadPreference (final List <TagSet > tagSetList , @ Nullable final Long maxStaleness , final TimeUnit timeUnit ,
392
400
@ Nullable final ReadPreferenceHedgeOptions hedgeOptions ) {
393
401
super (tagSetList , maxStaleness , timeUnit , hedgeOptions );
@@ -410,6 +418,7 @@ public TaggableReadPreference withMaxStalenessMS(@Nullable final Long maxStalene
410
418
return new SecondaryPreferredReadPreference (getTagSetList (), maxStaleness , timeUnit , getHedgeOptions ());
411
419
}
412
420
421
+ @ Deprecated
413
422
@ Override
414
423
public TaggableReadPreference withHedgeOptions (final ReadPreferenceHedgeOptions hedgeOptions ) {
415
424
return new SecondaryPreferredReadPreference (getTagSetList (), getMaxStaleness (MILLISECONDS ), MILLISECONDS , hedgeOptions );
@@ -441,6 +450,7 @@ static class NearestReadPreference extends TaggableReadPreference {
441
450
this (tagSetList , maxStaleness , timeUnit , null );
442
451
}
443
452
453
+ @ SuppressWarnings ("deprecation" )
444
454
NearestReadPreference (final List <TagSet > tagSetList , @ Nullable final Long maxStaleness , final TimeUnit timeUnit ,
445
455
@ Nullable final ReadPreferenceHedgeOptions hedgeOptions ) {
446
456
super (tagSetList , maxStaleness , timeUnit , hedgeOptions );
@@ -463,6 +473,7 @@ public TaggableReadPreference withMaxStalenessMS(@Nullable final Long maxStalene
463
473
return new NearestReadPreference (getTagSetList (), maxStaleness , timeUnit , getHedgeOptions ());
464
474
}
465
475
476
+ @ Deprecated
466
477
@ Override
467
478
public TaggableReadPreference withHedgeOptions (final ReadPreferenceHedgeOptions hedgeOptions ) {
468
479
return new NearestReadPreference (getTagSetList (), getMaxStaleness (MILLISECONDS ), MILLISECONDS , hedgeOptions );
@@ -503,6 +514,7 @@ static class PrimaryPreferredReadPreference extends SecondaryReadPreference {
503
514
this (tagSetList , maxStaleness , timeUnit , null );
504
515
}
505
516
517
+ @ SuppressWarnings ("deprecation" )
506
518
PrimaryPreferredReadPreference (final List <TagSet > tagSetList , @ Nullable final Long maxStaleness , final TimeUnit timeUnit ,
507
519
@ Nullable final ReadPreferenceHedgeOptions hedgeOptions ) {
508
520
super (tagSetList , maxStaleness , timeUnit , hedgeOptions );
@@ -525,6 +537,7 @@ public TaggableReadPreference withMaxStalenessMS(@Nullable final Long maxStalene
525
537
return new PrimaryPreferredReadPreference (getTagSetList (), maxStaleness , timeUnit , getHedgeOptions ());
526
538
}
527
539
540
+ @ Deprecated
528
541
@ Override
529
542
public TaggableReadPreference withHedgeOptions (final ReadPreferenceHedgeOptions hedgeOptions ) {
530
543
return new PrimaryPreferredReadPreference (getTagSetList (), getMaxStaleness (MILLISECONDS ), MILLISECONDS , hedgeOptions );
0 commit comments