Skip to content

Commit a749ba3

Browse files
committed
Improve logging in server monitor (#1060)
Log as error any exception except MongoInterruptedException in server monitor before exiting monitor thread JAVA-4822
1 parent ac2c632 commit a749ba3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

driver-core/src/main/com/mongodb/internal/connection/DefaultServerMonitor.java

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.mongodb.internal.connection;
1818

19+
import com.mongodb.MongoInterruptedException;
1920
import com.mongodb.MongoNamespace;
2021
import com.mongodb.MongoSocketException;
2122
import com.mongodb.ServerApi;
@@ -178,6 +179,10 @@ public void run() {
178179
}
179180
waitForNext();
180181
}
182+
} catch (MongoInterruptedException e) {
183+
// ignore
184+
} catch (RuntimeException e) {
185+
LOGGER.error(format("Server monitor for %s exiting with exception", serverId), e);
181186
} finally {
182187
if (connection != null) {
183188
connection.close();

0 commit comments

Comments
 (0)