hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Magnus Landrø <stefan.lan...@gmail.com>
Subject Re: Releasing resources when using CloseableHttpAsyncClient
Date Mon, 06 Jul 2015 08:17:31 GMT
try with resources in java will automatically call close().

2015-07-06 10:03 GMT+02:00 Simao Mata <simao.mata@carjump.de>:

> Hello,
> In the examples for the async hc version, I noticed the `close()` is always
> called after using the `CloseableHttpAsyncClient` instance, inside a
> `finally` block.
> I want to to reuse the `httpclient` instance, I always POST to the same
> url, so I want hc to try reusing the connection each time I call
> `.execute`. I am managing this http client instance inside an akka actor
> and I have control over the instance, so I just want to call `close` when
> the actor is restarted or stopped.
> What is the recommended way of handling this case? Just call `start` and
> `close` everytime I call `execute`? Or can I keep closing the connection
> only once I am really done with the client instance?
> Simao


TesTcl - a unit test framework for iRules

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message