@Immutable public class ClusterDescription extends Object
Constructor and Description |
---|
ClusterDescription(ClusterConnectionMode connectionMode,
ClusterType type,
List<ServerDescription> serverDescriptions)
Creates a new ClusterDescription.
|
ClusterDescription(ClusterConnectionMode connectionMode,
ClusterType type,
List<ServerDescription> serverDescriptions,
ClusterSettings clusterSettings,
ServerSettings serverSettings)
Creates a new ClusterDescription.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
Set<ServerDescription> |
getAll()
Deprecated.
Use
getServerDescriptions() instead |
List<ServerDescription> |
getAny()
Deprecated.
Replace with a filter on ServerDescription in the caller
|
List<ServerDescription> |
getAnyPrimaryOrSecondary()
Deprecated.
Replace with a filter on ServerDescription in the caller
|
List<ServerDescription> |
getAnyPrimaryOrSecondary(TagSet tagSet)
Deprecated.
Replace with a filter on ServerDescription in the caller
|
ServerDescription |
getByServerAddress(ServerAddress serverAddress)
Deprecated.
Replace with a filter on ServerDescription in the caller
|
ClusterSettings |
getClusterSettings()
Gets the cluster settings, which may be null if not provided.
|
ClusterConnectionMode |
getConnectionMode()
Gets whether this cluster is connecting to a single server or multiple servers.
|
List<ServerDescription> |
getPrimaries()
Deprecated.
Replace with a filter on ServerDescription in the caller
|
List<ServerDescription> |
getSecondaries()
Deprecated.
Replace with a filter on ServerDescription in the caller
|
List<ServerDescription> |
getSecondaries(TagSet tagSet)
Deprecated.
Replace with a filter on ServerDescription in the caller
|
List<ServerDescription> |
getServerDescriptions()
Returns an unmodifiable list of the server descriptions in this cluster description.
|
ServerSettings |
getServerSettings()
Gets the server settings, which may be null if not provided.
|
String |
getShortDescription()
Returns a short, pretty description for this ClusterDescription.
|
ClusterType |
getType()
Gets the specific type of this cluster
|
int |
hashCode() |
boolean |
hasReadableServer(ReadPreference readPreference)
Returns true if this cluster has at least one server that satisfies the given read preference.
|
boolean |
hasWritableServer()
Returns true if this cluster has at least one server that can be used for write operations.
|
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 ClusterDescription(ClusterConnectionMode connectionMode, ClusterType type, List<ServerDescription> serverDescriptions, ClusterSettings clusterSettings, ServerSettings serverSettings)
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 clusterclusterSettings
- the cluster settingsserverSettings
- the server settingspublic ClusterSettings getClusterSettings()
public ServerSettings getServerSettings()
public boolean isCompatibleWithDriver()
public boolean hasReadableServer(ReadPreference readPreference)
readPreference
- the non-null read preferencepublic boolean hasWritableServer()
public ClusterConnectionMode getConnectionMode()
public ClusterType getType()
public List<ServerDescription> getServerDescriptions()
@Deprecated public Set<ServerDescription> getAll()
getServerDescriptions()
instead@Deprecated public ServerDescription getByServerAddress(ServerAddress serverAddress)
serverAddress
- the ServerAddress for a server in this cluster@Deprecated public List<ServerDescription> getPrimaries()
@Deprecated public List<ServerDescription> getSecondaries()
@Deprecated public List<ServerDescription> getSecondaries(TagSet tagSet)
tagSet
- a Set of replica set tags@Deprecated public List<ServerDescription> getAny()
@Deprecated public List<ServerDescription> getAnyPrimaryOrSecondary()
@Deprecated public List<ServerDescription> getAnyPrimaryOrSecondary(TagSet tagSet)
tagSet
- a Set of replica set tagspublic String getShortDescription()