-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Ensure server discovery and monitoring events are published in order #860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
driver-core/src/main/com/mongodb/internal/connection/AbstractMultiServerCluster.java
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/BaseCluster.java
Outdated
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/DefaultClusterFactory.java
Outdated
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/SingleServerCluster.java
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/ClusterableServerFactory.java
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/DefaultSdamServerDescriptionManager.java
Show resolved
Hide resolved
* Ensure events are ordered according to how they are applied to driver state * Publish all events to application listeners one at a time, on a separate thread JAVA-4449
…h the new listener.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified based on in-person conversation. PTAL.
driver-core/src/main/com/mongodb/internal/connection/DefaultClusterFactory.java
Outdated
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/AsynchronousClusterEventListener.java
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/AsynchronousClusterEventListener.java
Outdated
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/AsynchronousClusterEventListener.java
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/AsynchronousClusterEventListener.java
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/internal/connection/AsynchronousClusterEventListener.java
Outdated
Show resolved
Hide resolved
...core/src/test/unit/com/mongodb/internal/connection/AsynchronousClusterEventListenerTest.java
Outdated
Show resolved
Hide resolved
...core/src/test/unit/com/mongodb/internal/connection/AsynchronousClusterEventListenerTest.java
Outdated
Show resolved
Hide resolved
I like the new approach for decorating listeners 👍 [optional] If you agree, the same can be done also in
As a result, the only place where |
driver-core/src/main/com/mongodb/internal/connection/AsynchronousClusterEventListener.java
Show resolved
Hide resolved
ClusterSettings clusterSettings; | ||
ServerSettings serverSettings; | ||
|
||
if (noClusterEventListeners(originalClusterSettings, originalServerSettings)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the vast number of clients never register a listener, avoiding thread/queue creation for that case.
&& serverSettings.getServerMonitorListeners().isEmpty(); | ||
} | ||
|
||
private static ClusterListener getClusterListener(final ClusterSettings clusterSettings) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small behavioral change here. Using multicaster when there is one listener registered, because the muilticaster will log exceptions thrown by the listeners, which should happen in all cases. Didn't seem worth it to add a non-multicasting exception-logging implementation.
JAVA-4449