primary
- Returns:
- ReadPreference which reads from primary only
TaggableReadPreference
final List<ServerDescription>
choose(ClusterDescription clusterDescription)
protected abstract List<ServerDescription>
chooseForNonReplicaSet(ClusterDescription clusterDescription)
protected abstract List<ServerDescription>
chooseForReplicaSet(ClusterDescription clusterDescription)
abstract String
getName()
abstract boolean
abstract boolean
static ReadPreference
nearest()
static ReadPreference
static TaggableReadPreference
static TaggableReadPreference
static TaggableReadPreference
static TaggableReadPreference
static ReadPreference
primary()
static ReadPreference
static ReadPreference
primaryPreferred(long maxStaleness,
TimeUnit timeUnit)
static TaggableReadPreference
primaryPreferred(TagSet tagSet)
static TaggableReadPreference
primaryPreferred(TagSet tagSet,
long maxStaleness,
TimeUnit timeUnit)
static TaggableReadPreference
primaryPreferred(List<TagSet> tagSetList)
static TaggableReadPreference
primaryPreferred(List<TagSet> tagSetList,
long maxStaleness,
TimeUnit timeUnit)
static ReadPreference
static ReadPreference
static TaggableReadPreference
static TaggableReadPreference
static TaggableReadPreference
static TaggableReadPreference
static ReadPreference
static ReadPreference
secondaryPreferred(long maxStaleness,
TimeUnit timeUnit)
static TaggableReadPreference
secondaryPreferred(TagSet tagSet)
static TaggableReadPreference
secondaryPreferred(TagSet tagSet,
long maxStaleness,
TimeUnit timeUnit)
static TaggableReadPreference
secondaryPreferred(List<TagSet> tagSetList)
static TaggableReadPreference
secondaryPreferred(List<TagSet> tagSetList,
long maxStaleness,
TimeUnit timeUnit)
abstract BsonDocument
static ReadPreference
static TaggableReadPreference
static TaggableReadPreference
abstract ReadPreference
withHedgeOptions(ReadPreferenceHedgeOptions hedgeOptions)
abstract ReadPreference
withMaxStalenessMS(Long maxStalenessMS,
TimeUnit timeUnit)
abstract ReadPreference
withTagSet(TagSet tagSet)
abstract ReadPreference
withTagSetList(List<TagSet> tagSet)
Note: this method is not supported for a primary read preference.
tagSet
- the new tag setNote: this method is not supported for a primary read preference.
tagSet
- the new tag set listNote: this method is not supported for a primary read preference.
maxStalenessMS
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessNote: this method is not supported for a primary read preference.
hedgeOptions
- the hedge optionsisSecondaryOk()
clusterDescription
- the cluster descriptionclusterDescription
- the cluster descriptionclusterDescription
- the cluster descriptionmaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
maxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
*maxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
maxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenesstagSet
- the set of tags to limit the list of secondaries to.tagSet
- the set of tags to limit the list of secondaries totagSet
- the set of tags to limit the list of secondaries totagSet
- the set of tags to limit the list of secondaries toThe driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
tagSet
- the set of tags to limit the list of secondaries to.maxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
tagSet
- the set of tags to limit the list of secondaries tomaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
*tagSet
- the set of tags to limit the list of secondaries tomaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
tagSet
- the set of tags to limit the list of secondaries tomaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenesstagSetList
- the list of tag sets to limit the list of secondaries totagSetList
- the list of tag sets to limit the list of secondaries totagSetList
- the list of tag sets to limit the list of secondaries totagSetList
- the list of tag sets to limit the list of secondaries toThe 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.
The driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
tagSetList
- the list of tag sets to limit the list of secondaries tomaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe 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.
The driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
tagSetList
- the list of tag sets to limit the list of secondaries tomaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe driver will look for a secondary with each tag set in the given list, stopping after one is found, or the primary if none are available.
The driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
tagSetList
- the list of tag sets to limit the list of secondaries tomaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessThe driver will look for a secondary with each tag set in the given list, stopping after one is found, or the primary if none are available.
The driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
tagSetList
- the list of tag sets to limit the list of secondaries tomaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStalenessname
- the name of the read preferencename
- the name of the read preferencetagSetList
- the list of tag setsThe driver estimates the staleness of each secondary, based on lastWriteDate values provided in server hello responses, and selects only those secondaries whose staleness is less than or equal to maxStaleness.
name
- the name of the read preferencetagSetList
- the list of tag setsmaxStaleness
- the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency
plus 10 seconds, whichever is greatest.timeUnit
- the time unit of maxStaleness
isSecondaryOk()