public final class MultiServerCluster
extends java.lang.Object
Constructor and Description |
---|
MultiServerCluster(ClusterId clusterId,
ClusterSettings settings,
ClusterableServerFactory serverFactory) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes connections to the servers in the cluster.
|
BsonTimestamp |
getClusterTime()
Get the last seen cluster time
|
ClusterDescription |
getCurrentDescription()
Get the current description of this cluster.
|
ClusterDescription |
getDescription()
Get the description of this cluster.
|
ClusterableServerFactory |
getServerFactory() |
ClusterSettings |
getSettings()
Gets the cluster settings with which this cluster was created.
|
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.
|
public MultiServerCluster(ClusterId clusterId, ClusterSettings settings, ClusterableServerFactory serverFactory)
public void close()
Cluster
public BsonTimestamp getClusterTime()
Cluster
getClusterTime
in interface Cluster
public Server selectServer(ServerSelector serverSelector)
Cluster
selectServer
in interface Cluster
serverSelector
- a ServerSelector that defines how to select the required Serverpublic void selectServerAsync(ServerSelector serverSelector, SingleResultCallback<Server> callback)
Cluster
selectServerAsync
in interface Cluster
serverSelector
- a ServerSelector that defines how to select the required Servercallback
- the callback to invoke when the server is found or an error occurspublic ClusterDescription getDescription()
Cluster
getDescription
in interface Cluster
public ClusterSettings getSettings()
Cluster
getSettings
in interface Cluster
public ClusterableServerFactory getServerFactory()
public boolean isClosed()
Cluster
public ClusterDescription getCurrentDescription()
Cluster
getCurrentDescription
in interface Cluster
Copyright © 2010 - 2020 Adobe. All Rights Reserved