@Immutable public class ClusterDescription extends java.lang.Object
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) |
ServerDescription |
findServerIncompatiblyNewerThanDriver()
Return a server in the cluster that is incompatibly newer than the driver.
|
ServerDescription |
findServerIncompatiblyOlderThanDriver()
Return a server in the cluster that is incompatibly older than the driver.
|
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.lang.Integer |
getLogicalSessionTimeoutMinutes()
Gets the logical session timeout in minutes, or null if at least one of the known servers does not support logical sessions.
|
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.
|
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 all servers in the cluster are compatible with the driver.
|
java.lang.String |
toString() |
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 ServerDescription findServerIncompatiblyOlderThanDriver()
public ServerDescription findServerIncompatiblyNewerThanDriver()
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()
public java.lang.Integer getLogicalSessionTimeoutMinutes()
@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()