Skip to content

Commit

Permalink
Improve logging in server monitor (#1060)
Browse files Browse the repository at this point in the history
Log as error any exception except MongoInterruptedException in server monitor
before exiting monitor thread

JAVA-4822
  • Loading branch information
jyemin committed Dec 5, 2022
1 parent ac2c632 commit a749ba3
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.mongodb.internal.connection;

import com.mongodb.MongoInterruptedException;
import com.mongodb.MongoNamespace;
import com.mongodb.MongoSocketException;
import com.mongodb.ServerApi;
Expand Down Expand Up @@ -178,6 +179,10 @@ public void run() {
}
waitForNext();
}
} catch (MongoInterruptedException e) {
// ignore
} catch (RuntimeException e) {
LOGGER.error(format("Server monitor for %s exiting with exception", serverId), e);
} finally {
if (connection != null) {
connection.close();
Expand Down

0 comments on commit a749ba3

Please sign in to comment.