Skip to content
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

Add closeHttpClient to MinioAsyncClient.Builder #1586

Closed
SerhiiKryvokin opened this issue Oct 10, 2024 · 2 comments
Closed

Add closeHttpClient to MinioAsyncClient.Builder #1586

SerhiiKryvokin opened this issue Oct 10, 2024 · 2 comments

Comments

@SerhiiKryvokin
Copy link
Contributor

In PR #1546 the logic was added to close httpClient when closing minio client.
However, if a custom httpClient is passed to the builder then closeHttpClient is set to false

Here is the code from MinioAsyncClient.java

boolean closeHttpClient = false;
  if (this.httpClient == null) {
    this.httpClient =
            HttpUtils.newDefaultHttpClient(
                    DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
    closeHttpClient = true;
}

So we set closeHttpClient to true only when httpClient is not passed to the builder and we create a default one

My proposal is to allow to pass closeHttpClient to the builder and even make it true by default
I can create PR for this if the idea is approved

@balamurugana
Copy link
Member

Yes. For custom http client, we do not set to close because it is user's responsibility when to close it. You could add a new builder method like public Builder httpClient(OkHttpClient httpClient, boolean close).

@SerhiiKryvokin
Copy link
Contributor Author

Solved in PR #1587

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

No branches or pull requests

2 participants