public static ReadPreference primaryPreferred(final long maxStaleness, final TimeUnit timeUnit) {
    """
	Gets a read preference that forces reads to the primary if available, otherwise to a secondary.
	
	@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.
	@since 3.4
	@see TaggableReadPreference#getMaxStaleness(TimeUnit)
    """
        return new PrimaryPreferredReadPreference(Collections.<TagSet>emptyList(), maxStaleness, timeUnit);
    }
public static ReadPreference primaryPreferred(final long maxStaleness, final TimeUnit timeUnit) {
        return new PrimaryPreferredReadPreference(Collections.<TagSet>emptyList(), maxStaleness, timeUnit);
    }
public static ReadPreference primaryPreferred ( final long maxStaleness , final TimeUnit timeUnit ) { return new PrimaryPreferredReadPreference ( Collections . < TagSet > emptyList ( ) , maxStaleness , timeUnit ) ; }
Gets a read preference that forces reads to the primary if available, otherwise to a secondary.

@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.
@since 3.4
@see TaggableReadPreference#getMaxStaleness(TimeUnit)
Gets a read preference that forces reads to the primary if available otherwise to a secondary .