@Immutable public class ClusterDescription extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static interface |
ClusterDescription.Predicate |
Modifier and Type | Field and Description |
---|---|
private ClusterSettings |
clusterSettings |
private ClusterConnectionMode |
connectionMode |
private java.util.List<ServerDescription> |
serverDescriptions |
private ServerSettings |
serverSettings |
private ClusterType |
type |
Constructor and Description |
---|
ClusterDescription(ClusterConnectionMode connectionMode,
ClusterType type,
java.util.List<ServerDescription> serverDescriptions)
Creates a new ClusterDescription.
|
ClusterDescription(ClusterConnectionMode connectionMode,
ClusterType type,
java.util.List<ServerDescription> serverDescriptions,
ClusterSettings clusterSettings,
ServerSettings serverSettings)
Creates a new ClusterDescription.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.util.Set<ServerDescription> |
getAll()
Deprecated.
Use
getServerDescriptions() instead |
java.util.List<ServerDescription> |
getAny()
Deprecated.
Replace with a filter on ServerDescription in the caller
|
java.util.List<ServerDescription> |
getAnyPrimaryOrSecondary()
Deprecated.
Replace with a filter on ServerDescription in the caller
|
java.util.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.
|
java.util.List<ServerDescription> |
getPrimaries()
Deprecated.
Replace with a filter on ServerDescription in the caller
|
java.util.List<ServerDescription> |
getSecondaries()
Deprecated.
Replace with a filter on ServerDescription in the caller
|
java.util.List<ServerDescription> |
getSecondaries(TagSet tagSet)
Deprecated.
Replace with a filter on ServerDescription in the caller
|
java.util.List<ServerDescription> |
getServerDescriptions()
Returns an unmodifiable list of the server descriptions in this cluster description.
|
private java.util.List<ServerDescription> |
getServersByPredicate(ClusterDescription.Predicate predicate) |
ServerSettings |
getServerSettings()
Gets the server settings, which may be null if not provided.
|
java.lang.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.
|
java.lang.String |
toString() |
private final ClusterConnectionMode connectionMode
private final ClusterType type
private final java.util.List<ServerDescription> serverDescriptions
private final ClusterSettings clusterSettings
private final ServerSettings serverSettings
public ClusterDescription(ClusterConnectionMode connectionMode, ClusterType type, java.util.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, java.util.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 java.util.List<ServerDescription> getServerDescriptions()
@Deprecated public java.util.Set<ServerDescription> getAll()
getServerDescriptions()
instead@Deprecated public ServerDescription getByServerAddress(ServerAddress serverAddress)
serverAddress
- the ServerAddress for a server in this cluster@Deprecated public java.util.List<ServerDescription> getPrimaries()
@Deprecated public java.util.List<ServerDescription> getSecondaries()
@Deprecated public java.util.List<ServerDescription> getSecondaries(TagSet tagSet)
tagSet
- a Set of replica set tags@Deprecated public java.util.List<ServerDescription> getAny()
@Deprecated public java.util.List<ServerDescription> getAnyPrimaryOrSecondary()
@Deprecated public java.util.List<ServerDescription> getAnyPrimaryOrSecondary(TagSet tagSet)
tagSet
- a Set of replica set tagspublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getShortDescription()
private java.util.List<ServerDescription> getServersByPredicate(ClusterDescription.Predicate predicate)