Skip to content

Commit 9b8ca57

Browse files
committed
JAVA-2139: Ensure that DefaultServerMonitor is closed in cleanup of tests
1 parent 07cc6d4 commit 9b8ca57

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

driver-core/src/test/unit/com/mongodb/connection/DefaultServerMonitorSpecification.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ class DefaultServerMonitorSpecification extends Specification {
219219
succeededEvent.connectionId == connectionDescription.connectionId
220220
succeededEvent.reply == BsonDocument.parse(isMasterResponse)
221221
succeededEvent.getElapsedTime(TimeUnit.NANOSECONDS) > 0
222+
223+
cleanup:
224+
monitor?.close()
222225
}
223226

224227
def 'should send started and failed heartbeat events'() {
@@ -291,5 +294,8 @@ class DefaultServerMonitorSpecification extends Specification {
291294
failedEvent.connectionId == connectionDescription.connectionId
292295
failedEvent.throwable == exception
293296
failedEvent.getElapsedTime(TimeUnit.NANOSECONDS) > 0
297+
298+
cleanup:
299+
monitor?.close()
294300
}
295301
}

0 commit comments

Comments
 (0)