Silverpop/engage-api-client — pull request #17 by msiuts (2014-05-14 16:17:03+00:00)
Title: Configure the used HttpClient to be thread-safe

This fixes #16 (https://github.com/Silverpop/engage-api-client/issues/16).
Using the ApiClient in a multi-threaded environment can lead to an exception and this warning:

WARN org.apache.commons.httpclient.SimpleHttpConnectionManager - SimpleHttpConnectionManager being used incorrectly. Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.

To fix this issue the HttpClient is now constructed with a MultiThreadedHttpConnectionManager. Also it is taken care, that releaseConnection() is called after excuting a HttpMethod. To ensure this the scope of the httpClient and the executeMethod() is narrowed to private.

For details on how to use HttpClient safely from within a multi-threaded environment see:
http://hc.apache.org/httpclient-3.x/threading.html