@Immutable public abstract class TaggableReadPreference extends ReadPreference
Modifier and Type | Method and Description |
---|---|
protected java.util.List<ServerDescription> |
chooseForNonReplicaSet(ClusterDescription clusterDescription) |
protected static ClusterDescription |
copyClusterDescription(ClusterDescription clusterDescription,
java.util.List<ServerDescription> selectedServers) |
boolean |
equals(java.lang.Object o) |
java.lang.Long |
getMaxStaleness(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum acceptable staleness of a secondary in order to be considered for read operations.
|
java.util.List<TagSet> |
getTagSetList()
Gets the list of tag sets as a list of
TagSet instances. |
int |
hashCode() |
boolean |
isSlaveOk()
True if this read preference allows reading from a secondary member of a replica set.
|
protected java.util.List<ServerDescription> |
selectFreshServers(ClusterDescription clusterDescription,
java.util.List<ServerDescription> servers) |
BsonDocument |
toDocument()
Gets a document representing this read preference in the wire protocol.
|
java.lang.String |
toString() |
choose, chooseForReplicaSet, getName, nearest, nearest, nearest, nearest, nearest, nearest, primary, primaryPreferred, primaryPreferred, primaryPreferred, primaryPreferred, primaryPreferred, primaryPreferred, secondary, secondary, secondary, secondary, secondary, secondary, secondaryPreferred, secondaryPreferred, secondaryPreferred, secondaryPreferred, secondaryPreferred, secondaryPreferred, valueOf, valueOf, valueOf
public boolean isSlaveOk()
ReadPreference
isSlaveOk
in class ReadPreference
public BsonDocument toDocument()
ReadPreference
toDocument
in class ReadPreference
public java.util.List<TagSet> getTagSetList()
TagSet
instances.public java.lang.Long getMaxStaleness(java.util.concurrent.TimeUnit timeUnit)
The maximum staleness feature is designed to prevent badly-lagging servers from being selected. The staleness estimate is imprecise and shouldn't be used to try to select "up-to-date" secondaries.
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.
timeUnit
- the time unit in which to return the valuepublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected java.util.List<ServerDescription> chooseForNonReplicaSet(ClusterDescription clusterDescription)
chooseForNonReplicaSet
in class ReadPreference
protected static ClusterDescription copyClusterDescription(ClusterDescription clusterDescription, java.util.List<ServerDescription> selectedServers)
protected java.util.List<ServerDescription> selectFreshServers(ClusterDescription clusterDescription, java.util.List<ServerDescription> servers)