hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaikit Savla <jaikit.sa...@yahoo.com>
Subject Reclaim connection once leaked after X time
Date Thu, 15 May 2014 03:06:12 GMT
Folks,

Is there a way to reclaim connections once they are leaked ? For testing I configured a client
with maxconnectionperservice=1 and IdleConnectionMonitorThread running every 5 seconds. My
test is leaking connection and once it runs 1 test, it fails with ConnectionPoolTimeoutException.
From the wire log I do see connection being made after request 1 even though I allocated just
1 connection per host. But test fails with ConnectionPoolTimeoutException as expected. I am
running with httpclient-4.3.3

Should IdleConnectionMonitorThread clean up leaked connections ? If not - is there any other
suggestion to handle buggy code leaking connections ?
Please find attached wire log. 

Test case:
    @Test(invocationCount = 3)
    public void testTwo() throws ClientProtocolException, IOException {
        HttpResponse response = httpclient.execute(new HttpGet("http://yahoo.com"));
        int status = response.getStatusLine().getStatusCode();
        response.getEntity();
        System.out.println(status);
        count++;
        System.out.println(count);

    }

Thanks,
Jaikit

Mime
View raw message