Skip to content

Make NettyStreamFactoryFactory implement AutoCloseable #1244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

jyemin
Copy link
Collaborator

@jyemin jyemin commented Nov 3, 2023

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

JAVA-5158

Note: If TransportSettings are used with the synchronous MongoClient, it currently won't close the StreamFactoryFactory. That will require a bit more refactoring than I wanted to do in this PR, and is not likely to be encountered by actual users, as there's no good reason that I know of to use Netty with the synchronous MongoClient.

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

JAVA-5158
@jyemin jyemin self-assigned this Nov 3, 2023
@jyemin jyemin requested a review from stIncMale November 6, 2023 16:38
@stIncMale
Copy link
Member

there's no good reason that I know of to use Netty with the synchronous MongoClient

Using EpollSocketChannel / OpenSSL for TLS / PreferredDirectByteBufAllocator (though I don't know about the benefits of the latter, if any), sharing a thread-pool between multiple MongoClients by sharing an EventLoopGroup.

Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: If TransportSettings are used with the synchronous MongoClient, it currently won't close the StreamFactoryFactory. That will require a bit more refactoring than I wanted to do in this PR

Created JAVA-5242.

@jyemin jyemin merged commit 554aa93 into mongodb:5.x Nov 14, 2023
@jyemin jyemin deleted the j5158 branch November 14, 2023 19:27
jyemin added a commit that referenced this pull request Dec 4, 2023
Since StreamFactoryFactory is now internal, just made that interface
extend AutoCloseable in order to simplify MongoClients code

JAVA-5158
jyemin added a commit that referenced this pull request Dec 5, 2023
Since StreamFactoryFactory is now internal, just made that interface
extend AutoCloseable in order to simplify MongoClients code

JAVA-5158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants