File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -469,7 +469,9 @@ public void dropDatabase(final String dbName) {
469
469
*/
470
470
public void close () {
471
471
cluster .close ();
472
- cursorCleaningService .shutdownNow ();
472
+ if (cursorCleaningService != null ) {
473
+ cursorCleaningService .shutdownNow ();
474
+ }
473
475
}
474
476
475
477
/**
Original file line number Diff line number Diff line change @@ -114,6 +114,12 @@ public void shouldSaveDefaultWriteConcern() throws UnknownHostException {
114
114
}
115
115
}
116
116
117
+ @ Test
118
+ public void shouldCloseWithoutExceptionWhenCursorFinalizerIsDisabled () {
119
+ Mongo mongo = new MongoClient (new ServerAddress (), MongoClientOptions .builder ().cursorFinalizerEnabled (false ).build ());
120
+ mongo .close ();
121
+ }
122
+
117
123
@ Test
118
124
@ SuppressWarnings ("deprecation" ) // This is for testing the old API, so it will use deprecated methods
119
125
public void shouldGetDB () throws UnknownHostException {
You can’t perform that action at this time.
0 commit comments