Package com.mongodb.connection
Class ClusterDescription
- java.lang.Object
- 
- com.mongodb.connection.ClusterDescription
 
- 
 @Immutable public class ClusterDescription extends Object Immutable snapshot state of a cluster.- Since:
- 3.0
 
- 
- 
Constructor SummaryConstructors Constructor Description ClusterDescription(ClusterConnectionMode connectionMode, ClusterType type, MongoException srvResolutionException, List<ServerDescription> serverDescriptions, ClusterSettings clusterSettings, ServerSettings serverSettings)Creates a new ClusterDescription.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.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)ServerDescriptionfindServerIncompatiblyNewerThanDriver()Return a server in the cluster that is incompatibly newer than the driver.ServerDescriptionfindServerIncompatiblyOlderThanDriver()Return a server in the cluster that is incompatibly older than the driver.ClusterSettingsgetClusterSettings()Gets the cluster settings, which may be null if not provided.ClusterConnectionModegetConnectionMode()Gets whether this cluster is connecting to a single server or multiple servers.IntegergetLogicalSessionTimeoutMinutes()Gets the logical session timeout in minutes, or null if at least one of the known servers does not support logical sessions.List<ServerDescription>getServerDescriptions()Returns an unmodifiable list of the server descriptions in this cluster description.ServerSettingsgetServerSettings()Gets the server settings, which may be null if not provided.StringgetShortDescription()Returns a short, pretty description for this ClusterDescription.MongoExceptiongetSrvResolutionException()Gets any exception encountered while resolving the SRV record for the initial host.ClusterTypegetType()Gets the specific type of this clusterinthashCode()booleanhasReadableServer(ReadPreference readPreference)Returns true if this cluster has at least one server that satisfies the given read preference.booleanhasWritableServer()Returns true if this cluster has at least one server that can be used for write operations.booleanisCompatibleWithDriver()Return whether all servers in the cluster are compatible with the driver.StringtoString()
 
- 
- 
- 
Constructor Detail- 
ClusterDescriptionpublic ClusterDescription(ClusterConnectionMode connectionMode, ClusterType type, List<ServerDescription> serverDescriptions) Creates a new ClusterDescription.- Parameters:
- connectionMode- whether to connect directly to a single server or to multiple servers
- type- what sort of cluster this is
- serverDescriptions- the descriptions of all the servers currently in this cluster
 
 - 
ClusterDescriptionpublic ClusterDescription(ClusterConnectionMode connectionMode, ClusterType type, List<ServerDescription> serverDescriptions, ClusterSettings clusterSettings, ServerSettings serverSettings) Creates a new ClusterDescription.- Parameters:
- connectionMode- whether to connect directly to a single server or to multiple servers
- type- what sort of cluster this is
- serverDescriptions- the descriptions of all the servers currently in this cluster
- clusterSettings- the cluster settings
- serverSettings- the server settings
- Since:
- 3.4
 
 - 
ClusterDescriptionpublic ClusterDescription(ClusterConnectionMode connectionMode, ClusterType type, MongoException srvResolutionException, List<ServerDescription> serverDescriptions, ClusterSettings clusterSettings, ServerSettings serverSettings) Creates a new ClusterDescription.- Parameters:
- connectionMode- whether to connect directly to a single server or to multiple servers
- type- what sort of cluster this is
- srvResolutionException- an exception resolving the SRV record
- serverDescriptions- the descriptions of all the servers currently in this cluster
- clusterSettings- the cluster settings
- serverSettings- the server settings
- Since:
- 3.10
 
 
- 
 - 
Method Detail- 
getClusterSettingspublic ClusterSettings getClusterSettings() Gets the cluster settings, which may be null if not provided.- Returns:
- the cluster settings
- Since:
- 3.4
 
 - 
getServerSettingspublic ServerSettings getServerSettings() Gets the server settings, which may be null if not provided.- Returns:
- the server settings
- Since:
- 3.4
 
 - 
isCompatibleWithDriverpublic boolean isCompatibleWithDriver() Return whether all servers in the cluster are compatible with the driver.- Returns:
- true if all servers in the cluster are compatible with the driver
 
 - 
findServerIncompatiblyOlderThanDriver@Nullable public ServerDescription findServerIncompatiblyOlderThanDriver() Return a server in the cluster that is incompatibly older than the driver.- Returns:
- a server in the cluster that is incompatibly older than the driver, or null if there are none
- Since:
- 3.6
 
 - 
findServerIncompatiblyNewerThanDriver@Nullable public ServerDescription findServerIncompatiblyNewerThanDriver() Return a server in the cluster that is incompatibly newer than the driver.- Returns:
- a server in the cluster that is incompatibly newer than the driver, or null if there are none
- Since:
- 3.6
 
 - 
hasReadableServerpublic boolean hasReadableServer(ReadPreference readPreference) Returns true if this cluster has at least one server that satisfies the given read preference.- Parameters:
- readPreference- the non-null read preference
- Returns:
- whether this cluster has at least one server that satisfies the given read preference
- Since:
- 3.3
 
 - 
hasWritableServerpublic boolean hasWritableServer() Returns true if this cluster has at least one server that can be used for write operations.- Returns:
- true if this cluster has at least one server that can be used for write operations
- Since:
- 3.3
 
 - 
getConnectionModepublic ClusterConnectionMode getConnectionMode() Gets whether this cluster is connecting to a single server or multiple servers.- Returns:
- the ClusterConnectionMode for this cluster
 
 - 
getTypepublic ClusterType getType() Gets the specific type of this cluster- Returns:
- a ClusterType enum representing the type of this cluster
 
 - 
getSrvResolutionException@Nullable public MongoException getSrvResolutionException() Gets any exception encountered while resolving the SRV record for the initial host.- Returns:
- any exception encountered while resolving the SRV record for the initial host, or null if none
- Since:
- 3.10
 
 - 
getServerDescriptionspublic List<ServerDescription> getServerDescriptions() Returns an unmodifiable list of the server descriptions in this cluster description.- Returns:
- an unmodifiable list of the server descriptions in this cluster description
- Since:
- 3.3
 
 - 
getLogicalSessionTimeoutMinutes@Nullable public Integer getLogicalSessionTimeoutMinutes() Gets the logical session timeout in minutes, or null if at least one of the known servers does not support logical sessions.- Returns:
- the logical session timeout in minutes, which may be null
- Since:
- 3.6
- Since server release
- 3.6
 
 - 
getShortDescriptionpublic String getShortDescription() Returns a short, pretty description for this ClusterDescription.- Returns:
- a String describing this cluster.
 
 
- 
 
-