@Immutable public class ClusterDescription extends Object
Constructor and Description |
---|
ClusterDescription(ClusterConnectionMode connectionMode,
ClusterType type,
List<ServerDescription> serverDescriptions)
Creates a new ClusterDescription.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
Set<ServerDescription> |
getAll()
Returns the Set of all server descriptions in this cluster, sorted by the String value of the ServerAddress of each one.
|
List<ServerDescription> |
getAny()
Gets a list of ServerDescriptions for all the servers in this cluster which are currently accessible.
|
List<ServerDescription> |
getAnyPrimaryOrSecondary()
Gets a list of all the primaries and secondaries in this cluster.
|
List<ServerDescription> |
getAnyPrimaryOrSecondary(TagSet tagSet)
Gets a list of all the primaries and secondaries in this cluster that match the given replica set tags.
|
ServerDescription |
getByServerAddress(ServerAddress serverAddress)
Returns the ServerDescription for the server at the given address
|
ClusterConnectionMode |
getConnectionMode()
Gets whether this cluster is connecting to a single server or multiple servers.
|
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.
|
List<ServerDescription> |
getSecondaries()
Get a list of all the secondaries in this cluster
|
List<ServerDescription> |
getSecondaries(TagSet tagSet)
Get a list of all the secondaries in this cluster that match a given TagSet
|
String |
getShortDescription()
Returns a short, pretty description for this ClusterDescription.
|
ClusterType |
getType()
Gets the specific type of this cluster
|
int |
hashCode() |
boolean |
isCompatibleWithDriver()
Return whether the cluster is compatible with the driver.
|
String |
toString() |
public ClusterDescription(ClusterConnectionMode connectionMode, ClusterType type, List<ServerDescription> serverDescriptions)
connectionMode
- whether to connect directly to a single server or to multiple serverstype
- what sort of cluster this isserverDescriptions
- the descriptions of all the servers currently in this clusterpublic boolean isCompatibleWithDriver()
public ClusterConnectionMode getConnectionMode()
public ClusterType getType()
public Set<ServerDescription> getAll()
public ServerDescription getByServerAddress(ServerAddress serverAddress)
serverAddress
- the ServerAddress for a server in this clusterpublic List<ServerDescription> getPrimaries()
public List<ServerDescription> getSecondaries()
public List<ServerDescription> getSecondaries(TagSet tagSet)
tagSet
- a Set of replica set tagspublic List<ServerDescription> getAny()
public List<ServerDescription> getAnyPrimaryOrSecondary()
public List<ServerDescription> getAnyPrimaryOrSecondary(TagSet tagSet)
tagSet
- a Set of replica set tagspublic String getShortDescription()