Interface ClusterListener

All Superinterfaces:

public interface ClusterListener extends EventListener
A listener for cluster-related events.

All events received by ClusterListener, ServerListener, ServerMonitorListener are totally ordered (and the event order implies the happens-before order), provided that the listeners are not shared by different MongoClients. This guarantee holds even if you have a single class implementing all of ClusterListener, ServerListener, ServerMonitorListener. However, this guarantee does not mean that implementations automatically do not need to synchronize memory accesses to prevent data races. For example, if data that the listener collects in memory is accessed outside of the normal execution of the listener by the MongoClient, then reading and writing actions must be synchronized.

See Also:
  • Method Details

    • clusterOpening

      default void clusterOpening(ClusterOpeningEvent event)
      Invoked when a cluster is opened.
      event - the event
    • clusterClosed

      default void clusterClosed(ClusterClosedEvent event)
      Invoked when a cluster is closed.
      event - the event
    • clusterDescriptionChanged

      default void clusterDescriptionChanged(ClusterDescriptionChangedEvent event)
      Invoked when a cluster description changes.
      event - the event