@Immutable class ClusterDescription extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static interface |
ClusterDescription.Predicate |
| Modifier and Type | Field and Description |
|---|---|
private java.util.Set<ServerDescription> |
all |
private ClusterConnectionMode |
connectionMode |
private ClusterType |
type |
| Constructor and Description |
|---|
ClusterDescription(ClusterConnectionMode connectionMode,
ClusterType type,
java.util.List<ServerDescription> serverDescriptions) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.util.Set<ServerDescription> |
getAll()
Returns the Set of all server descriptions in this cluster, sorted by the String value of the ServerAddress of each one.
|
java.util.List<ServerDescription> |
getAny() |
java.util.List<ServerDescription> |
getAnyPrimaryOrSecondary() |
java.util.List<ServerDescription> |
getAnyPrimaryOrSecondary(TagSet tags) |
ServerDescription |
getByServerAddress(ServerAddress serverAddress) |
ClusterConnectionMode |
getConnectionMode() |
java.util.List<ServerDescription> |
getPrimaries()
While it may seem counter-intuitive that a MongoDb cluster can have more than one primary, it can in the case where the client's view
of the cluster is a set of mongos servers, any of which can serve as the primary.
|
java.util.List<ServerDescription> |
getSecondaries() |
java.util.List<ServerDescription> |
getSecondaries(TagSet tags) |
private java.util.List<ServerDescription> |
getServersByPredicate(ClusterDescription.Predicate predicate) |
java.lang.String |
getShortDescription() |
ClusterType |
getType() |
int |
hashCode() |
boolean |
isCompatibleWithDriver()
Return whether the cluster is compatible with the driver.
|
java.lang.String |
toString() |
private final ClusterConnectionMode connectionMode
private final ClusterType type
private final java.util.Set<ServerDescription> all
public ClusterDescription(ClusterConnectionMode connectionMode, ClusterType type, java.util.List<ServerDescription> serverDescriptions)
public boolean isCompatibleWithDriver()
public ClusterConnectionMode getConnectionMode()
public ClusterType getType()
public java.util.Set<ServerDescription> getAll()
public ServerDescription getByServerAddress(ServerAddress serverAddress)
public java.util.List<ServerDescription> getPrimaries()
public java.util.List<ServerDescription> getSecondaries()
public java.util.List<ServerDescription> getSecondaries(TagSet tags)
public java.util.List<ServerDescription> getAny()
public java.util.List<ServerDescription> getAnyPrimaryOrSecondary()
public java.util.List<ServerDescription> getAnyPrimaryOrSecondary(TagSet tags)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getShortDescription()
private java.util.List<ServerDescription> getServersByPredicate(ClusterDescription.Predicate predicate)