Package com.mongodb.connection
Interface Cluster
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
AbstractMultiServerCluster
,DnsMultiServerCluster
,MultiServerCluster
,SingleServerCluster
Deprecated.
Represents a cluster of MongoDB servers. Implementations can define the behaviour depending upon the type of cluster.
- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Deprecated.Closes connections to the servers in the cluster.Deprecated.Get the last seen cluster timeDeprecated.Get the current description of this cluster.Deprecated.Get the description of this cluster.Deprecated.Gets the cluster settings with which this cluster was created.boolean
isClosed()
Deprecated.Whether all the servers in the cluster are closed or not.selectServer
(ServerSelector serverSelector) Deprecated.Get a MongoDB server that matches the criteria defined by the serverSelectorvoid
selectServerAsync
(ServerSelector serverSelector, SingleResultCallback<Server> callback) Deprecated.Asynchronously gets a MongoDB server that matches the criteria defined by the serverSelector.
-
Method Details
-
getSettings
ClusterSettings getSettings()Deprecated.Gets the cluster settings with which this cluster was created.- Returns:
- the cluster settings
- Since:
- 3.4
-
getDescription
ClusterDescription getDescription()Deprecated.Get the description of this cluster. This method will not return normally until the cluster type is known.- Returns:
- a ClusterDescription representing the current state of the cluster
- Throws:
MongoTimeoutException
- if the timeout has been reached before the cluster type is known
-
getCurrentDescription
ClusterDescription getCurrentDescription()Deprecated.Get the current description of this cluster.- Returns:
- the current ClusterDescription representing the current state of the cluster.
-
getClusterTime
Deprecated.Get the last seen cluster time- Returns:
- the last seen cluster time or null if not set
- Since:
- 3.8
-
selectServer
Deprecated.Get a MongoDB server that matches the criteria defined by the serverSelector- Parameters:
serverSelector
- a ServerSelector that defines how to select the required Server- Returns:
- a Server that meets the requirements
- Throws:
MongoTimeoutException
- if the timeout has been reached before a server matching the selector is available
-
selectServerAsync
Deprecated.Asynchronously gets a MongoDB server that matches the criteria defined by the serverSelector.- Parameters:
serverSelector
- a ServerSelector that defines how to select the required Servercallback
- the callback to invoke when the server is found or an error occurs
-
close
void close()Deprecated.Closes connections to the servers in the cluster. After this is called, this cluster instance can no longer be used.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
isClosed
boolean isClosed()Deprecated.Whether all the servers in the cluster are closed or not.- Returns:
- true if all the servers in this cluster have been closed
-