Skip to content

Add closeHttpClient to MinioAsyncClient.Builder #1586

@SerhiiKryvokin

Description

@SerhiiKryvokin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions