public interface Cluster extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes connections to the servers in the cluster.
|
ClusterDescription |
getDescription()
Get the description of this cluster.
|
boolean |
isClosed()
Whether all the servers in the cluster are closed or not.
|
Server |
selectServer(ServerSelector serverSelector)
Get a MongoDB server that matches the criteria defined by the serverSelector
|
void |
selectServerAsync(ServerSelector serverSelector,
SingleResultCallback<Server> callback)
Asynchronously gets a MongoDB server that matches the criteria defined by the serverSelector.
|
ClusterDescription getDescription()
MongoTimeoutException
- if the timeout has been reached before the cluster type is knownServer selectServer(ServerSelector serverSelector)
serverSelector
- a ServerSelector that defines how to select the required ServerMongoTimeoutException
- if the timeout has been reached before a server matching the selector is availablevoid selectServerAsync(ServerSelector serverSelector, SingleResultCallback<Server> callback)
serverSelector
- a ServerSelector that defines how to select the required Servercallback
- the callback to invoke when the server is found or an error occursvoid close()
close
in interface AutoCloseable
close
in interface Closeable
boolean isClosed()