Skip to content

Commit 774f4c0

Browse files
authored
Improve logging in server monitor (#1060)
Log as error any exception except MongoInterruptedException in server monitor before exiting monitor thread JAVA-4822
1 parent 41b9ce3 commit 774f4c0

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

Lines changed: 5 additions & 0 deletions
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;
@@ -179,6 +180,10 @@ public void run() {
179180
}
180181
waitForNext();
181182
}
183+
} catch (MongoInterruptedException e) {
184+
// ignore
185+
} catch (RuntimeException e) {
186+
LOGGER.error(format("Server monitor for %s exiting with exception", serverId), e);
182187
} finally {
183188
if (connection != null) {
184189
connection.close();

0 commit comments

Comments
 (0)