driver-core/src/main/com/mongodb/ReadPreference.java
public static TaggableReadPreference primaryPreferred(final List<TagSet> tagSetList,
                                                          final long maxStaleness, final TimeUnit timeUnit) {
        return new PrimaryPreferredReadPreference(tagSetList, maxStaleness, timeUnit);
    }
public static TaggableReadPreference primaryPreferred(final List<TagSet> tagSetList,
                                                          final long maxStaleness, final TimeUnit timeUnit) {
        return new PrimaryPreferredReadPreference(tagSetList, maxStaleness, timeUnit);
    }
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with one of the given sets of tags
that is less stale than the given maximum.

<p>
The driver will look for a secondary with each tag set in the given list, stopping after one is found,
or failing if no secondary can be found that matches any of the tag sets in the list.
</p>

<p>
The driver estimates the staleness of each secondary, based on lastWriteDate values provided in server isMaster responses,
and selects only those secondaries whose staleness is less than or equal to maxStaleness.
</p>

@param tagSetList the list of tag sets to limit the list of secondaries to
@param maxStaleness the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.
@param timeUnit the time unit of maxStaleness
@return ReadPreference which reads primary if available, otherwise a secondary respective of tags.
@since 3.4
@see TaggableReadPreference#getMaxStaleness(TimeUnit)