[JAVA-5158] Make NettyStreamFactoryFactory implement AutoCloseable Created: 12/Sep/23  Updated: 05/Dec/23  Resolved: 14/Nov/23

Status: Closed
Project: Java Driver
Component/s: Internal
Affects Version/s: None
Fix Version/s: 5.0.0

Type: Improvement Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on JAVA-5161 Remove deprecated Stream-related types Closed
Related
related to JAVA-5242 Close StreamFactoryFactory when closi... Backlog
Quarter: FY24Q4
Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

By default NettyStreamFactoryFactory creates an NioEventLoopGroup instance and does not close it when the MongoClient closes. We should change the behavior so that it does. We can follow the pattern from TlsChannelStreamFactoryFactory and make it Closeable, and pass it as an externalResourceCloser to the MongoClient implementation.

Since Netty can technically be used even for sync client, this same pattern needs to be applied there as well.



 Comments   
Comment by Githook User [ 05/Dec/23 ]

Author:

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

Message: Make NettyStreamFactoryFactory implement AutoCloseable (#1244)

Since StreamFactoryFactory is now internal, just made that interface
extend AutoCloseable in order to simplify MongoClients code

JAVA-5158
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/5e8d7b67eb4e39f03d612ad753f2c4ab71f74e1d

Generated at Thu Feb 08 09:03:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.