Package com.mongodb.event
Interface ClusterListener
- All Superinterfaces:
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 MongoClient
s. 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.
- Since:
- 3.3
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
clusterClosed
(ClusterClosedEvent event) Invoked when a cluster is closed.default void
Invoked when a cluster description changes.default void
Invoked when a cluster is opened.
-
Method Details
-
clusterOpening
Invoked when a cluster is opened.- Parameters:
event
- the event
-
clusterClosed
Invoked when a cluster is closed.- Parameters:
event
- the event
-
clusterDescriptionChanged
Invoked when a cluster description changes.- Parameters:
event
- the event
-