Package com.mongodb.connection
Interface Cluster
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
AbstractMultiServerCluster
,DnsMultiServerCluster
,MultiServerCluster
,SingleServerCluster
@Deprecated public interface Cluster extends java.io.Closeable
Deprecated.Represents a cluster of MongoDB servers. Implementations can define the behaviour depending upon the type of cluster.- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
close()
Deprecated.Closes connections to the servers in the cluster.BsonTimestamp
getClusterTime()
Deprecated.Get the last seen cluster timeClusterDescription
getCurrentDescription()
Deprecated.Get the current description of this cluster.ClusterDescription
getDescription()
Deprecated.Get the description of this cluster.ClusterSettings
getSettings()
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.Server
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 Detail
-
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
@Nullable BsonTimestamp getClusterTime()
Deprecated.Get the last seen cluster time- Returns:
- the last seen cluster time or null if not set
- Since:
- 3.8
-
selectServer
Server selectServer(ServerSelector serverSelector)
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
void selectServerAsync(ServerSelector serverSelector, SingleResultCallback<Server> callback)
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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
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
-
-