Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Multi-Thread issue #22

@mettini

Description

@mettini

Hi,

I'm having some problems when I try to send messages in a multi-thread scenario (with the same httpclient instance, using PoolingHttpClientConnectionManager).

After the message is sent in MandrillRESTRequest, the connections aren't closed; when the app reaches the max conn set in httpclient, the messages get blocked and aren't sent.

I fixed it making a copy of MandrillRESTRequest in my working directory and converting HttpClient to CloseableHttpClient (httpclient 4.3.1) and HttpResponse to CloseableHttpResponse, to be able to do this modification:

try {
entity = response.getEntity();
} finally {
response.close();
}
BufferedReader br = new BufferedReader(new InputStreamReader((entity.getContent())));

(this recommendation of closing the connection in a multi-thread environment is detailed here: http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e392).

Maybe there's a way to do this connection close without modifying method signature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions