@Immutable public abstract class TaggableReadPreference extends ReadPreference
Modifier and Type | Method | Description |
---|---|---|
protected List<ServerDescription> |
chooseForNonReplicaSet(ClusterDescription clusterDescription) |
|
protected static ClusterDescription |
copyClusterDescription(ClusterDescription clusterDescription,
List<ServerDescription> selectedServers) |
|
boolean |
equals(Object o) |
|
Long |
getMaxStaleness(TimeUnit timeUnit) |
Gets the maximum acceptable staleness of a secondary in order to be considered for read operations.
|
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 List<ServerDescription> |
selectFreshServers(ClusterDescription clusterDescription,
List<ServerDescription> servers) |
|
BsonDocument |
toDocument() |
Gets a document representing this read preference in the wire protocol.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
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 List<TagSet> getTagSetList()
TagSet
instances.@Nullable public Long getMaxStaleness(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 valueprotected List<ServerDescription> chooseForNonReplicaSet(ClusterDescription clusterDescription)
chooseForNonReplicaSet
in class ReadPreference
protected static ClusterDescription copyClusterDescription(ClusterDescription clusterDescription, List<ServerDescription> selectedServers)
protected List<ServerDescription> selectFreshServers(ClusterDescription clusterDescription, List<ServerDescription> servers)