[JAVA-3099] com.mongodb.MongoClient should implement the close method Created: 21/Nov/18  Updated: 28/Oct/23  Resolved: 22/Nov/18

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 3.9.1

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-3000 Deprecate Mongo class Closed

 Description   

com.mongodb.MongoClient implements Closeable, but the close method is actually defined in com.mongodb.Mongo, its superclass. This shouldn't generate a compiler warning, but Eclipse is complaining about it anyway. See JAVA-3000.

The solution is probably to add a close method to MongoClient that just calls super.close.



 Comments   
Comment by Githook User [ 14/Jan/19 ]

Author:

{'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}

Message: Implement Closeable directly in MongoClient

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
Branch: 3.10.x
https://github.com/mongodb/mongo-java-driver/commit/b752b3c333cd99e32323a4d30ef67a8b949872f7

Comment by Githook User [ 22/Nov/18 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}

Message: Implement Closeable directly in MongoClient

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
Branch: 3.9.x
https://github.com/mongodb/mongo-java-driver/commit/3ebe0c697036bd3e0c304b8fd243ed831bfa84e6

Comment by Githook User [ 22/Nov/18 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}

Message: Implement Closeable directly in MongoClient

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
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/b8c78bd7c8115e6a1bd62bc9a197e9d3f34e2021

Comment by Ken Kolano [X] [ 21/Nov/18 ]

That does resolve this.

Comment by Jeffrey Yemin [ 21/Nov/18 ]

OK, Kolano Can you give the 3.9.1-SNAPSHOT a try: https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/3.9.1-SNAPSHOT/ ?

Generated at Thu Feb 08 08:58:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.