Interface Cluster

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
AbstractMultiServerCluster, DnsMultiServerCluster, MultiServerCluster, SingleServerCluster

@Deprecated public interface Cluster extends Closeable
Deprecated.
Represents a cluster of MongoDB servers. Implementations can define the behaviour depending upon the type of cluster.
Since:
3.0
  • 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

      @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 Server
      callback - 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 interface AutoCloseable
      Specified by:
      close in interface 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