Skip to content

Commit

Permalink
Implement Closeable directly in MongoClient
Browse files Browse the repository at this point in the history
Some tools are generating spurious warnings about this, because while
MongoClient implements Closeable, the close method itself is implemented
in the deprecated Mongo superclass.

JAVA-3099
  • Loading branch information
jyemin committed Nov 21, 2018
1 parent 21dbd43 commit 3ebe0c6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions driver-legacy/src/main/com/mongodb/MongoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,14 @@ public <TResult> ChangeStreamIterable<TResult> watch(final ClientSession clientS
return createChangeStreamIterable(clientSession, pipeline, resultClass);
}

/**
* Closes all resources associated with this instance, in particular any open network connections. Once called, this instance and any
* databases obtained from it can no longer be used.
*/
public void close() {
super.close();
}

private <TResult> ChangeStreamIterable<TResult> createChangeStreamIterable(@Nullable final ClientSession clientSession,
final List<? extends Bson> pipeline,
final Class<TResult> resultClass) {
Expand Down

0 comments on commit 3ebe0c6

Please sign in to comment.