//Is this step necessary ?? Need to check as only status code is required //httpPost.abort(); //HttpEntity entity = response.getEntity(); //And this ? //EntityUtils.consume(entity);
Guess what? It.
One MUST ensure that the response content is consumed so that the underlying connection is released back to the connection manager. A call to either EntityUtils#consume or httpUriRequest#abort triggers the release of a connection to the pool. The difference is that the former tries to keep the connection alive until the latter does.
source share